| Author | Topic | 
                            
                                    | kfb5926Starting Member
 
 
                                        7 Posts | 
                                            
                                            |  Posted - 2010-12-09 : 17:29:16 
 |  
                                            | The dm_db_missing_index_group_stats DMV is suggesting I add two indexes. I'm wondering if I can kill two birds with one stone:Index 1:Table: RMEquality: [CUSTNMBR]Inequality: [RMDTYPAL]Included columns: [DOCNUMBR], [CURTRXAM]Index 2:Table: RMEquality: [CUSTNMBR], [VOIDSTTS]Inequality: [RMDTYPAL]Included columns: [CPRCSTNM], [DOCNUMBR], [CURTRXAM]Would creating index 2 satisfy index 1? |  | 
       
                            
                       
                          
                            
                                    | tkizerAlmighty SQL Goddess
 
 
                                    38200 Posts |  | 
                            
                       
                          
                            
                                    | GilaMonsterMaster Smack Fu Yak Hacker
 
 
                                    4507 Posts | 
                                        
                                          |  Posted - 2010-12-09 : 18:06:30 
 |  
                                          | quote:Kinda, partially, not entirely.Index 1 would have the key columns CUSTNMBR, RMDTYPALIndex 2 would have the key columns CUSTNMBR, VOIDSTTS, RMDTYPALIf a query filters just on CUSTNMBR and RMDTYPAL it can only partially seek on the second index. http://sqlinthewild.co.za/index.php/2009/02/06/index-columns-selectivity-and-inequality-predicates/It may be good enough, only you can answer that by testing.p.s. The missing index DMV is a reasonable place to start looking at indexes, not a good place to end. Test any suggestions out thoroughly.--Gail ShawSQL Server MVPOriginally posted by kfb5926
 Would creating index 2 satisfy index 1?
 
 |  
                                          |  |  | 
                            
                       
                          
                            
                                    | tkizerAlmighty SQL Goddess
 
 
                                    38200 Posts |  | 
                            
                       
                          
                            
                                    | kfb5926Starting Member
 
 
                                    7 Posts | 
                                        
                                          |  Posted - 2010-12-09 : 22:26:50 
 |  
                                          | Thanks for the help! |  
                                          |  |  | 
                            
                       
                          
                            
                                    | kfb5926Starting Member
 
 
                                    7 Posts |  | 
                            
                       
                          
                            
                                    | tkizerAlmighty SQL Goddess
 
 
                                    38200 Posts |  | 
                            
                       
                          
                            
                                    | GilaMonsterMaster Smack Fu Yak Hacker
 
 
                                    4507 Posts | 
                                        
                                          |  Posted - 2010-12-10 : 02:04:52 
 |  
                                          | quote:That's not what the missing index DMV suggests though. Since it's suggestion has 2 columns as equalities and one as inequality, the order it's suggesting for the second is CUSTNMBR, VOIDSTTS, RMDTYPALWith CUSTNMBR, RMDTYPAL, VOIDSTTS if a query does equality predicates on CUSTNMBR and VOIDSTTS it will only be able to partially use that index.--Gail ShawSQL Server MVPOriginally posted by tkizer
 Agreed.  I was thinking it would be in this order though:Index 1 would have the key columns CUSTNMBR, RMDTYPALIndex 2 would have the key columns CUSTNMBR, RMDTYPAL, VOIDSTTS
 
 |  
                                          |  |  | 
                            
                       
                          
                            
                                    | kfb5926Starting Member
 
 
                                    7 Posts |  | 
                            
                       
                          
                            
                                    | kfb5926Starting Member
 
 
                                    7 Posts | 
                                        
                                          |  Posted - 2010-12-10 : 09:27:39 
 |  
                                          | Actually, I think that 200MB is the size of the existing table, not the index. |  
                                          |  |  | 
                            
                            
                                |  |