From: | jkoceniak(at)mediamath(dot)com |
---|---|
To: | pgsql-bugs(at)postgresql(dot)org |
Subject: | BUG #14411: Issue with using OFFSET |
Date: | 2016-11-03 20:29:12 |
Message-ID: | 20161103202912.15989.78255@wrigleys.postgresql.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-bugs |
The following bug has been logged on the website:
Bug reference: 14411
Logged by: Jamie Koceniak
Email address: jkoceniak(at)mediamath(dot)com
PostgreSQL version: 9.4.6
Operating system: Linux
Description:
Query performance decreases as the OFFSET increases.
Bad Query:
SELECT t1.id, ( SELECT count ( * ) FROM site_list_sites t4 WHERE t1.id =
t4.site_list_id ) AS sites_count
FROM site_lists t1
WHERE t1.organization_id IN ( SELECT distinct organization_id FROM
user_permissions ( 2385 ))
ORDER BY t1.created_on DESC LIMIT 100 OFFSET 200;
With offset set to 100, query returns in 92ms
Query Plan (offset = 100):
https://explain.depesz.com/s/nnPd
offset = 200, query take 9.8 seconds
Query plan (offset=200)
https://explain.depesz.com/s/MQAS
From | Date | Subject | |
---|---|---|---|
Next Message | Kevin Grittner | 2016-11-03 22:52:16 | Re: BUG #14411: Issue with using OFFSET |
Previous Message | Tom Lane | 2016-11-03 14:13:25 | Re: Compilation of timezone source with zic fails (on mountpoint) |