From: oyvind.harboe@zylin.com
To: pgsql-bugs@postgresql.org
Subject: BUG #13112: Catastrophic performance degradation without DISTINCT ON statement
Date: Tue, 21 Apr 2015 07:16:22 +0000
Message-ID: <20150421071622.5211.13275@wrigleys.postgresql.org> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>
The following bug has been logged on the website:
Bug reference: 13112
Logged by: Øyvind Harboe
Email address: oyvind.harboe@zylin.com
PostgreSQL version: 9.1.0
Operating system: Ubuntu
Description:
I've been testing out PostgreSQL vs. Derby/MS SQL for our application when I
ran into a problem where the performance of PostgreSQL went from great to
abysmal for no apparent reason.
After a bit of digging, I've found that the problem is with the SQL
statement that Apache Cayenne generates.
Apache Cayenne generates statements of the following form which yields bad
performance on PostgreSQL with complicated WHERE statements and numerous
columns:
1) SELECT DISTINCT a,b,c,d,e,f ... WHERE somecomplicatedstatement
If I rewrite this statement to the form below using the 'DISTINCT ON()'
syntax(which is PostgreSQL specific dialect), then I get great performance
again:
2) SELECT DISTINCT ON(a) a,b,c,d,e,f ... WHERE somecomplicatedstatement
Numbers on my machine:
1) 44000ms
2) 4300ms
Here's where I read up on the DISTINCT ON syntax:
http://www.postgresql.org/docs/9.4/static/sql-select.html
--
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs
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-bugs@postgresql.org
Cc: oyvind.harboe@zylin.com
Subject: Re: BUG #13112: Catastrophic performance degradation without DISTINCT ON statement
In-Reply-To: <20150421071622.5211.13275@wrigleys.postgresql.org>
References: <20150421071622.5211.13275@wrigleys.postgresql.org>
* 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