pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Kirk Wolak <wolakk@gmail.com>
Cc: pgsql-general <pgsql-general@lists.postgresql.org>
Subject: Re: A performance issue in ROW_NUMBER() OVER(ORDER BY NULL) [27 times slow than OVER()] V14.5
Date: Sun, 19 Feb 2023 16:18:07 -0500
Message-ID: <3330162.1676841487@sss.pgh.pa.us> (raw)
In-Reply-To: <CACLU5mS7Wc=xANexj7KSPMX2PRnv6FwDDHQn2DW+MY1UDBJm3A@mail.gmail.com>
References: <CACLU5mS7Wc=xANexj7KSPMX2PRnv6FwDDHQn2DW+MY1UDBJm3A@mail.gmail.com>

Kirk Wolak <wolakk@gmail.com> writes:
>   I have some converted code that uses this syntax.

Seems kinda dumb, but ...

>   The solution is to remove the ORDER BY NULL.  [since that is not
> sortable, should it be ignored?]
>   This does NOT SHOW UP with 1 million rows.

I don't see it at all.  Comparing your two test queries on released
branches, I see maybe 2x penalty for the ORDER BY NULL, not 30x.
(In HEAD there's only about 13% penalty.)  I wonder what PG version
you are testing.

			regards, tom lane





view thread (8+ messages)  latest in thread

Message-ID: <3330162.1676841487@sss.pgh.pa.us>
Permalink:  ../3330162.1676841487@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/3330162.1676841487@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: tgl@sss.pgh.pa.us, wolakk@gmail.com
  Subject: Re: A performance issue in ROW_NUMBER() OVER(ORDER BY NULL) [27 times slow than OVER()] V14.5
  In-Reply-To: <3330162.1676841487@sss.pgh.pa.us>
  References: <CACLU5mS7Wc=xANexj7KSPMX2PRnv6FwDDHQn2DW+MY1UDBJm3A@mail.gmail.com> <3330162.1676841487@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox