Re: Query planner issue with preferring primary key over a better index when using ORDER BY and LIMIT

From: Mladen Gogala <gogala(dot)mladen(at)gmail(dot)com>
To: pgsql-general(at)lists(dot)postgresql(dot)org
Subject: Re: Query planner issue with preferring primary key over a better index when using ORDER BY and LIMIT
Date: 2021-12-07 04:06:46
Message-ID: bd16c72f-fb80-ed53-eea6-197f33e86362@gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 12/6/21 22:16, Laurenz Albe wrote:
> An ugly alternative is to use "ORDER BY id + 0", which prevents PostgreSQL
> from using the index.

That was actually the earliest form of Oracle hints. I remember doing
exactly that in Oracle 5.1.22 on VAX/VMS.

--
Mladen Gogala
Database Consultant
Tel: (347) 321-1217
https://dbwhisperer.wordpress.com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2021-12-07 05:18:56 Re: Are Foreign Key Disabled During Logical Replication Initial Sync?
Previous Message Laurenz Albe 2021-12-07 03:16:27 Re: Query planner issue with preferring primary key over a better index when using ORDER BY and LIMIT