» How important is the order of columns in indexes?
How important is the order of columns in indexes?
|February 18, 2010
Posted by forumadmin
I’ve heard that you should put columns that will be the most selective at the beginning of the index declaration. Example:
CREATE NONCLUSTERED INDEX MyINDX on Table1
First off, is what I’m saying correct? If so, am i likely to see large differences in performance by rearranging the order of the columns in my index or is it more of a “nice to do” practice?
The reason I’m asking is because after putting a query through the DTA it recommended that I create an index that had almost all of the same columns in it as an existing index, just in a different order. I was considering just adding the missing columns to the existing index and calling it good. Thoughts?
More Related Questions
- TSQL Finding Order that occurred in 3 consecutive months Please help me to generate the following query. Say I have customer table and order table.
- How do I create unique constraint that also allows nulls in sql server Adding a column to table, and I want a unique constraint, so the column will insert GUID's, but to allow for existing data before column was added, I need to allow for NULL's in the […]
- How can I do an UPDATE statement with JOIN in SQL? I need to update this table in MS SQL Server 2005 with data from its 'parent' table, see below:
- SQL update query using joins I have to update a field with a value which is returned by a join of 3 tables.
,im.sku as iSku
,gm.SKU as GSKU
,mm.ManufacturerId as ManuId
- Drop all the tables, stored procedures, triggers, constraints and all the dependencies in one sql statement Is there any way in which I can clean a database in SQl Server 2005 by dropping all the tables and deleting stored procedures, triggers, constraints and all the dependencies in one SQL […]
- How to append to a text field in t-sql SQL Server 2005 What is the best way to append to a text field using t-sql in Sql Server 2005?
With a varchar I would do this.
update tablename set fieldname = fieldname + 'appended string'
But this […]
- SQL Server – pull X random records per state I have a table with records for each zip code in the united states. For the purposes of displaying on a map, I need to select X random records per state. How would I go about doing […]
- How to SELECT * INTO [temp table] FROM [stored procedure] How do I do a SELECT * INTO [temp table] FROM [stored procedure]? Not FROM [Table] and without defining [temp table]?
Select all data from BusinessLine into tmpBusLine works fine.
- sp_replmonitorsubscriptionpendingcmds into a table [How2] Im looking to making a job that will tell me the number of pending cmd's on the replication,
Im using sp_replmonitorsubscriptionpendingcmds and im trying my best to put it into a […]
- Find previous & next entries in alphabetical index for a candidate In a database, I have a string field. I want to find previous & next row in alphabetical order for a candidate string that is not in the database. One solution is to insert temporarily […]