From: Melzer Kassensysteme <office@melzer-kassen.com>
To: pgsql-bugs@lists.postgresql.org
Subject: LIMIT clause extremely slow
Date: Wed, 15 Nov 2023 17:46:21 +0100
Message-ID: <00f201da17e3$439404c0$cabc0e40$@melzer-kassen.com> (raw)
Hi,
I have an issue using a limit clause, f.ex.
SELECT * FROM table WHERE (index1 > 1 OR (index1 = 1 AND index2 > 5)) ORDER
BY index1, index2 LIMIT 1
index1 and index2 are index fields of datatype integer.
This takes some 100 times longer than in Mysql or other databases under same
conditions (and I have to repeat this command very often, so time is adding
up).
I have read in some forums that you can fasten it up by saying
ORDER BY index1 + 0, index2 + 0
The result is better, but still very slow.
Using version 16.1
Thanks for your help and best regards, Florian Melzer
___________________________________________
Melzer GmbH
Schlagturn 26, A-6135 Stans
FN 463940s beim LG Innsbruck mit Sitz in Stans
UID: ATU71726803
Tel +43 (0) 5242 71361
<http://www.melzer-kassen.com/; www.melzer-kassen.com
<mailto:office@melzer-kassen.com> office@melzer-kassen.com
Attachments:image001.jpg (image/jpeg, 5.5K) downloadview image
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 using the --to and --cc options:
reply via email
To: pgsql-bugs@postgresql.org
Cc: office@melzer-kassen.com, pgsql-bugs@lists.postgresql.org
Subject: Re: LIMIT clause extremely slow
In-Reply-To: <00f201da17e3$439404c0$cabc0e40$@melzer-kassen.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