Question about search speed

william humphrey bill at bluewatermaritime.com
Mon Jan 28 07:47:47 CST 2013


I wish someone had told me to put creation dates in more of my tables. They
are so useful.

On Mon, Jan 28, 2013 at 9:37 AM, Bart Pietercil
<bart.pietercil at cognosis.be>wrote:

> Do you have a creation date time for your records ?
>
> select * from myTable order by creation_dt DESC limit 20
>
> hth
>
> Bart
>
>
> On 28 Jan 2013, at 14:33, 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).
> >
> > Thanks,
> >
> > Jon
> > _______________________________________________
> > Valentina mailing list
> > Valentina at lists.macserve.net
> > http://lists.macserve.net/mailman/listinfo/valentina
>
> _______________________________________________
> Valentina mailing list
> Valentina at lists.macserve.net
> http://lists.macserve.net/mailman/listinfo/valentina
>



-- 
http://www.bluewatermaritime.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macserve.net/pipermail/valentina/attachments/20130128/926a7456/attachment.html>


More information about the Valentina mailing list