pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Mladen Gogala <gogala.mladen@gmail.com>
To: pgsql-general@lists.postgresql.org
Subject: Re: Query planner issue with preferring primary key over a better index when using ORDER BY and LIMIT
Date: Mon, 6 Dec 2021 23:06:46 -0500
Message-ID: <bd16c72f-fb80-ed53-eea6-197f33e86362@gmail.com> (raw)
In-Reply-To: <82b3a0d97f5ee6279f1c7e6048c510b07f0b313b.camel@cybertec.at>
References: <bc47e9d0c490942eebb01dc1129097012005e1d2.camel@lists.simkin.ca>
	<CA+bJJbxT55278A6B3vUKHgNR-aSDd6YWbSvKb_KMNO9c6ZEbGQ@mail.gmail.com>
	<CAFj8pRDsmF2PVKOQK47EhOfhSPrKuRoUSfb=cwJJSM+NubbUMg@mail.gmail.com>
	<82b3a0d97f5ee6279f1c7e6048c510b07f0b313b.camel@cybertec.at>

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






view thread (13+ messages)  latest in thread

Message-ID: <bd16c72f-fb80-ed53-eea6-197f33e86362@gmail.com>
Permalink:  ../bd16c72f-fb80-ed53-eea6-197f33e86362@gmail.com/
Also on:    postgresql.org/message-id/bd16c72f-fb80-ed53-eea6-197f33e86362@gmail.com

 · 

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: gogala.mladen@gmail.com
  Subject: Re: Query planner issue with preferring primary key over a better index when using ORDER BY and LIMIT
  In-Reply-To: <bd16c72f-fb80-ed53-eea6-197f33e86362@gmail.com>
  References: <bc47e9d0c490942eebb01dc1129097012005e1d2.camel@lists.simkin.ca> <CA+bJJbxT55278A6B3vUKHgNR-aSDd6YWbSvKb_KMNO9c6ZEbGQ@mail.gmail.com> <CAFj8pRDsmF2PVKOQK47EhOfhSPrKuRoUSfb=cwJJSM+NubbUMg@mail.gmail.com> <82b3a0d97f5ee6279f1c7e6048c510b07f0b313b.camel@cybertec.at> <bd16c72f-fb80-ed53-eea6-197f33e86362@gmail.com>

* 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