db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Matrigali <mikem_...@sbcglobal.net>
Subject Re: Very slow
Date Wed, 01 Jun 2005 17:41:00 GMT
Also, at least for serializable isolation level table scan will result
in a table level lock, where an index scan will only get a row lock.

Sunitha Kambhampati wrote:
> 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.
> 
> 


Mime
View raw message