Re: Query plan for "id IS NULL" on PK

From: "Peter J(dot) Holzer" <hjp-pgsql(at)hjp(dot)at>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Query plan for "id IS NULL" on PK
Date: 2023-02-14 22:43:04
Message-ID: 20230214224304.ykdgobmkqpaygbth@hjp.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2023-02-14 15:36:32 -0700, Rob Sargent wrote:
> But if the query is supposed to be generic and re-used in a situation where id
> could be null, wouldn't the null id records be fetched every time? 

No, they will never be fetched because of the AND (("id" <= ?)).

hp

--
_ | Peter J. Holzer | Story must make more sense than reality.
|_|_) | |
| | | hjp(at)hjp(dot)at | -- Charles Stross, "Creative writing
__/ | http://www.hjp.at/ | challenge!"

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Rob Sargent 2023-02-14 22:44:17 Re: Query plan for "id IS NULL" on PK
Previous Message Peter J. Holzer 2023-02-14 22:39:17 Re: Query plan for "id IS NULL" on PK