From: laconic2@comcast.net   
      
   "DiggidyMack69" wrote:   
      
   > I several queries that join a number of indexed tables by various id   
   > numbers that are used to pull up only a couple rows (so I think   
   > selectivity is high). The tables are all in the 2000 - 50000 range in   
   > number of rows.   
      
   There is a case known as "walking the index". This might be called an   
   "index scan".   
   It's often slower than a table scan. Either one is much slower than an   
   index lookup.   
   It can come up when a compound index is used, but the prime key of the   
   compound index is unspecified.   
      
   example:   
      
   create index MY_INDEX on MY_TABLE (OBJECT_TYPE, OBJECT_ID);   
      
   select * from MY_TABLE where OBJECT_ID = 7654321;   
      
      
   MY_INDEX can't be used for a lookup, because the OBJECT_TYPE hasn't been   
   specified.   
      
   if we try   
      
   select * from MY_TABLE where OBJECT_ID = 7654321   
    and OBJECT_TYPE = 1;   
      
   The same query runs blazingly fast. Why? Because now the index is being   
   used for a lookup,   
   not a scan.   
      
   I don't know enough about your case to know if this is relevant. But I hope   
   it helps.   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|