Jack Klebanoff wrote:

Sunitha Kambhampati wrote:

Edson Carlos Ericksson Richter wrote:

I've run with derby.language.logQueryPlan=true and result is that I have table scan for only one table, that has actually one record.



I am curious as to why a table scan is being picked. Does this table have indexes that can be used for the query in question ? Also what isolation level is this query running at.

Sunitha.

If the table only has one row then a table scan is faster than an index scan.


True for one row case.

But lets say the table is modified to have more rows and then it probably makes sense to have an index scan , but you will be stuck with a tablescan for this query till the query gets recompiled as a result of a stale plan check. (right ?). So it still seems it would be better for the optimizer to pick an index scan when it can instead of table scan even for a single row.

Sunitha.

Reply via email to