Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options questions only not deleted user 22336

A database structure that can improve the speed of queries at the cost of disk space and slower inserts/updates. It stores a copy of one or more columns sorted but structures the data differently to allow faster access.

14 votes
2 answers
9k views

space usage on sys.allocation_units and sp_spaceused

I am working on a monitoring tool, want to know disk size of each index and data, etc. Eventually I would like to find the right fill factor, and other things etc. … sys.allocation_units a ON p.partition_id = a.container_id WHERE t.NAME NOT LIKE 'dt%' AND i.OBJECT_ID > 255 AND T.NAME = 'tblBOrderRelationship' the figures the bigger picture, including the index
Marcello Miorelli's user avatar
4 votes
3 answers
2k views

Partitioned Tables and Indexes - what are the downsides?

When talking about Partitioned Tables and Indexes for tables with less than 100 partitions, no nonaligned indexes: with that I mean: Nonaligned index An index partitioned independently … The index key is unique and it does not contain the partitioning column of the table. …
Marcello Miorelli's user avatar
0 votes
1 answer
580 views

how to find tables with either sparse or a column set column?

from the error message below: A compressed index is not supported on table that contains sparse columns or a column set column as I was rebuilding an index and changing the data_compression to …
Marcello Miorelli's user avatar
7 votes
1 answer
28k views

Query processor could not produce a query plan because of the hints defined in this query [duplicate]

[applicationStateChange] AS ac1 WITH(INDEX(FI_ASC_ChangeDate)) WHERE ac1.applicationID = 130002 AND AC1.newStatus = 'PLC' -- and this is my filtered index - this index is just … -- adding the column newStatus to the index did not solve the problem, neither in the index nor in the include: CREATE NONCLUSTERED INDEX FI_ASC_ChangeDate ON [dbo]. …
Marcello Miorelli's user avatar
0 votes
2 answers
301 views

a filtered index to support a query - is it possible to consider nulls?

So I would like to have the following filtered index: CREATE NONCLUSTERED INDEX F_INVOICEID ON dbo.accountTransaction ( INVOICEID ) INCLUDE ( accountAmount) WHERE (notCountedInTotal IN (null, … is there a work around for when you want to put an OR inside a filtered index? would I not get into the same issue as below? Unable to create a Filtered Index on a Computed Column …
Marcello Miorelli's user avatar
19 votes
5 answers
6k views

Unable to create a Filtered Index on a Computed Column

But when I try to create an index on my column I get the following error: CREATE INDEX FIX_tblBGiftVoucherItem_incl ON dbo.tblBGiftVoucherItem (strItemNo) INCLUDE (strTier3) WHERE isUsGift = 1; … How can I create a filtered index on a computed column? or Is there an alternative solution? …
Marcello Miorelli's user avatar
2 votes
1 answer
350 views

Indexed View - how to verify if it is worthy?

view: CREATE view VProcessStatus WITH SCHEMABINDING AS select processstatus, StatusCount = COUNT_BIG(*) FROM DBO.tbltaxtransaction GROUP BY processstatus CREATE UNIQUE CLUSTERED INDEX
Marcello Miorelli's user avatar
3 votes
1 answer
110 views

calculating the total number of rows in a table - fails when it is a heap - is there any fix?

I have a procedure that I use to find out how big is a table. select * from sys.objects where name = 'WMS_SLALoad' -- to get the object_id of my table -- in this case it is 2041058307 SELECT o.objec …
Marcello Miorelli's user avatar
3 votes
2 answers
2k views

Using the database engine tuning advisor - how do I generate the scripts for the recommendat...

I have run a server-side profile trace for over an hour to produce a .trc file with all activities in one of my databases. I have then passed this .trc trace file as a parameter to the database engin …
Marcello Miorelli's user avatar
3 votes
1 answer
109 views

What if all the non clustered indexes on my table were filtered indexes?

4 non clustered indexes 1 filtered index and the primary key non clustered defined above CREATE CLUSTERED INDEX [CIX_ProductImages__ProductImageID] ON [dbo]. … NONCLUSTERED INDEX [IDX_ProdImages_GetProductListingPageDenormalisedData] ON [dbo]. …
Marcello Miorelli's user avatar
1 vote
1 answer
2k views

Remote harden of transaction 'CREATE INDEX' - when moving an index to a different filegroup

This is an example of one of my statements: CREATE NONCLUSTERED INDEX idx_applicationID_activityDate ON [dbo]. … QUESTION: What does this message really mean, and how does it interfere in my index creation? …
Marcello Miorelli's user avatar
1 vote
1 answer
527 views

passing the parameters of sp_executesql to sp_ineachdb or sp_foreachdb

For example the code below checks for an index inside a database: declare @IndexName NVARCHAR(128)='si_xdes_id' declare @dbname NVARCHAR(128) = db_name() DECLARE @sql NVARCHAR(MAX) DECLARE … @ParamDefinition NVARCHAR(MAX) DECLARE @retval INT IF @IndexName IS NOT NULL /*validate the index exists in the @dbname database*/ BEGIN SELECT @sql = 'SELECT @retvalOUT = CASE WHEN …
Marcello Miorelli's user avatar
2 votes
1 answer
490 views

data compression does not show when scripting index on ssms

when I right click on SSMS and choose to script the create index: I get this script, without the data_compression: USE [APCore] GO /****** Object: Index [i_agencyId] Script Date: 07/11/2019 12 … :18:13 ******/ CREATE UNIQUE NONCLUSTERED INDEX [i_agencyId] ON [agy]. …
Marcello Miorelli's user avatar
5 votes
2 answers
2k views

dateadd in the where clause - how can I avoid a full scan in this particular situation?

The index actually get used, but it is a full scan. It can also be seen here: This is my index definition: USE [APCore]; CREATE NONCLUSTERED INDEX i_flightDateLatest ON [app]. … Update: After the accepted answer, changed the query accordingly and now the index is used in a seek operation as you can see on the picture below. …
Marcello Miorelli's user avatar
2 votes
2 answers
660 views

how to find out the `Key Lookups` in the current query plan?

I am putting a query to list the key lookups that are present in the current requests being executed, I basically would like to tackle then and see if I could eliminate these key lookup from the execu …
Marcello Miorelli's user avatar

15 30 50 per page