News for hackers. Stuff that matters.
Re:How to assert that your SQL does not do full table scans by praptak on Friday March 26, 2010 @10:30AM (#1221077)
Yup, and with single-column indexes on both of the columns it will try to pick one with better selectivity.
Re:How to assert that your SQL does not do full table scans by ergo98 on Friday March 26, 2010 @10:43AM (#1221119)
>Yup, and with single-column indexes on both of the columns it will try to pick one with better selectivity

If the selectivity yields an estimated result more than -- in most cases -- about 2% of the data, the database system will not use the index.

Re:How to assert that your SQL does not do full table scans by Femur on Friday March 26, 2010 @11:17AM (#1221214)
That is not necessarily true. The 'last ditch' operation oracle will perform before a full-table scan is an index range-scan (very IO intensive compared with common index use).

There are MANY factors in play. Stats, parameters, histograms... it really depends.

Re:How to assert that your SQL does not do full table scans by ergo98 on Friday March 26, 2010 @11:24AM (#1221231)
>That is not necessarily true. The 'last ditch' operation oracle will perform before a full-table scan is an index range-scan (very IO intensive compared with common index use).

Only if the index is covering.

Re:How to assert that your SQL does not do full table scans by praptak on Friday March 26, 2010 @12:55PM (#1221466)
Seems rational - with enough records per page fetching 2% of the records might mean fetching >90% of the pages, which of course doesn't really improve over full scan.
Re:How to assert that your SQL does not do full table scans by kevingadd on Friday March 26, 2010 @11:03AM (#1221160)
Out of curiosity, where did you get that number? It's a very interesting, informative factoid. Is it in the Oracle documentation, or is it based on observation/testing?
Re:How to assert that your SQL does not do full table scans by ergo98 on Friday March 26, 2010 @11:16AM (#1221211)
Mostly from observation of systems in the field, though it is a very hard to gauge number. I had one install where the I/O rate of the disk subsystem was dramatically faster than the query plan was estimating (it was going too far to avoid I/O over forward read speed) and I discovered that there was absolutely no way to control its setting globally, instead having to add forced-index hints.