Re: DELETE does not use index
Posted in 1997
>Sorry for my stupid question, but what does UPDATE STATISTICS do in detail? No such thing as a stupid question. UPDATE STATSTICS updates information in the database catalogue, such as systables, sysindexes, sysdistributions. Information from these catalogue tables is read by the engine and is used by the optimizer to determine what the best possible query plan should be. The optimizer will then create an execution plan for the query. Often when a bad query plan is executed, it is because the statistics about the database is not accruate enough. This would cause things like doing a sequential scan of a table when an index search would be better. For instance, if a table is very small, then a sequential scan will always be faster than indexing into the table. However, suppose that same small table suddenly had over 100000 rows. If update statistics had not been run, the a bad query plan would be generated because the optimizer would think that there were only 10 rows to the table. Madison Pruet