Re: Planner doesn't look at LIMIT?

From: PFC <lists(at)boutiquenumerique(dot)com>
To: "Dawid Kuroczko" <qnex42(at)gmail(dot)com>, "Postgresql Performance" <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Planner doesn't look at LIMIT?
Date: 2005-07-22 13:16:57
Message-ID: op.subgiji7th1vuj@localhost
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance


Which row do you want ? Do you want 'a row' at random ?
I presume you want the N latest rows ?
In that case you should use an ORDER BY on an indexed field, the serial
primary key will do nicely (ORDER BY id DESC) ; it's indexed so it will
use the index and it will fly.

> Any ideas how to make it work (other than rewriting the query to use
> subselects, use explicit id-rows, disabling hashjoin completely)?
> Or is this a bug?
>
> Regards,
> Dawid
>
> ---------------------------(end of broadcast)---------------------------
> TIP 9: In versions below 8.0, the planner will ignore your desire to
> choose an index scan if your joining column's datatypes do not
> match
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2005-07-22 13:17:06 Re: [PATCHES] Roles - SET ROLE Updated
Previous Message Jeff Trout 2005-07-22 12:49:18 Re: Timezone bugs

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2005-07-22 14:39:57 Re: Planner doesn't look at LIMIT?
Previous Message Dawid Kuroczko 2005-07-22 09:10:05 Planner doesn't look at LIMIT?