Re: A performance issue in ROW_NUMBER() OVER(ORDER BY NULL) [27 times slow than OVER()] V14.5

From: Kirk Wolak <wolakk(at)gmail(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-general <pgsql-general(at)lists(dot)postgresql(dot)org>, Pavel Stehule <pavel(dot)stehule(at)gmail(dot)com>
Subject: Re: A performance issue in ROW_NUMBER() OVER(ORDER BY NULL) [27 times slow than OVER()] V14.5
Date: 2023-02-20 15:49:21
Message-ID: CACLU5mT2AU_Sk2Hx5xbCMET-b0_ph01CpVwXfpMXnruEVx_F_g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sun, Feb 19, 2023 at 4:18 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:

> Kirk Wolak <wolakk(at)gmail(dot)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
>
Tom,
I put V14.5 in the subject line (I could have made it more clear).
It appears in new versions, as confirmed by Pavel, it is already
addressed in some newer versions.

Also, would it make sense to have EXPLAIN output the version of PG? I
think that might be useful,
because it becomes a COMMON next question?

Thanks,

Kirk Out!

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Marc Millas 2023-02-20 16:57:34 pg_reload_conf()
Previous Message Tom Lane 2023-02-20 14:58:49 Re: A performance issue in ROW_NUMBER() OVER(ORDER BY NULL) [27 times slow than OVER()] V14.5