Re: Determining which index to create

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Eric Cholet <cholet(at)logilune(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Determining which index to create
Date: 2001-11-21 11:48:22
Message-ID: 20011121224822.A537@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Nov 21, 2001 at 12:23:07PM +0100, Eric Cholet wrote:
> I would like to optimize the following query:
>
> => select * from dico_frs where motid=4742 order by date desc limit 10;
>
> But it's still quite slow. I'm thinking an index on (motid, date desc)
> would be best
> but that doesn't seem to be possible. How can I optimize this query?

Indexes (at least btree ones) can be scanned in either forward or backward
directions. So an index on (motid,date) should be fine.
--
Martijn van Oosterhout <kleptog(at)svana(dot)org>
http://svana.org/kleptog/
> Magnetism, electricity and motion are like a three-for-two special offer:
> if you have two of them, the third one comes free.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Eric Cholet 2001-11-21 11:53:09 Re: Determining which index to create
Previous Message Roman Havrylyak 2001-11-21 11:37:45 What size of block should I choose?