[thelist] Select *

Scott Dexter sgd at ti3.com
Thu Oct 12 12:08:22 CDT 2000


 
> - If you are only selecting a couple of fields and they all 
> happen to be in the index you are using, the DBMS can get 
> away with only reading the index and not the physical record, 
> resulting in one less disk access.


fergot this one, and its a beauty. By doing Select *, you are almost
_guaranteeing_ a full table scan, because the query optimizer has no idea
what you're looking for. Picking the columns gives it hints, and if you
index on commonly searched columns (duh), it will choose the index over a
table scan, and like Adam say, if the index completely holds the columns in
the select statement, the db doesn't even hafta go to the table. --MAKE SURE
YOUR INDEXES ARE UP TO DATE! =)

sgd




More information about the thelist mailing list