Question about search speed

jda jda at his.com
Mon Jan 28 08:03:39 CST 2013


On Jan 28, 2013, at 8:58 AM, Ivan Smahin <ivan_smahin at paradigmasoft.com> wrote:

> 
> On Jan 28, 2013, at 3:33 PM, jda <jda at his.com> wrote:
> 
>> 
>> I have a built-in search that finds the last 20 records entered. Each record has a unique sequential number (1..N) in the field "id", and this is the query:
>> 
>> 
>>    SELECT * FROM mytable WHERE id > (select max(id) - 20 from mytable)
>> 
>> 
>> It works, but is very slow. With a database of ~7000 records it takes ~20 seconds.
>> 
>> Is there a way to optimize this (using V4.9.1, Mac OS X).
>> 
> 
> 
> Thinking more of this ...
> Is ID field indexed?
> Could you send me that db to test it here?
> 

Hi,

id is a VLong, not indexed.

Would you still like the database?

Jon



More information about the Valentina mailing list