Re: Query performance going from Oracle to Postgres - Mailing list pgsql-general

From David Rowley
Subject Re: Query performance going from Oracle to Postgres
Date
Msg-id CAApHDvqr31P5fgMot0y=dSsXmHOf9AT7g0E_+LWtJ7Z7dgK0sA@mail.gmail.com
Whole thread Raw
In response to Query performance going from Oracle to Postgres  ("Dirschel, Steve" <steve.dirschel@thomsonreuters.com>)
List pgsql-general
On Thu, 7 Sept 2023 at 11:14, Dirschel, Steve
<steve.dirschel@thomsonreuters.com> wrote:
> select count(historyeve0_.HISTORY_EVENT_SID) as col_0_0_ from hist28.history_event_display_timestamp_20230301
historyeve0_where historyeve0_.IS_DELETED=0
 

> history_event_sid      | character varying(32)          |           | not null |

Do you get an Index Only Scan if you use count(*) instead of
count(historyeve0_.HISTORY_EVENT_SID)?

It seems that column is the only one missing from the index and that
might be the only thing that's stopping PostgreSQL using an Index Only
Scan. Perhaps Oracle realises that the column is NOT NULL so can do
count(*) instead of counting the non-nulls from that column.  That may
allow it to Index Only Scan? I'm not versed in reading Oracle plans so
don't know if it's possible to tell.

David



pgsql-general by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: Query performance going from Oracle to Postgres
Next
From: Peter Geoghegan
Date:
Subject: Re: Query performance going from Oracle to Postgres