Re: Query plan for "id IS NULL" on PK - Mailing list pgsql-general

From Peter J. Holzer
Subject Re: Query plan for "id IS NULL" on PK
Date
Msg-id 20230214224304.ykdgobmkqpaygbth@hjp.at
Whole thread Raw
In response to Re: Query plan for "id IS NULL" on PK  (Rob Sargent <robjsargent@gmail.com>)
Responses Re: Query plan for "id IS NULL" on PK
List 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@hjp.at         |    -- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |       challenge!"

Attachment

pgsql-general by date:

Previous
From: "Peter J. Holzer"
Date:
Subject: Re: Query plan for "id IS NULL" on PK
Next
From: Rob Sargent
Date:
Subject: Re: Query plan for "id IS NULL" on PK