From: | Max Lipsky <maxlipsky(at)gmail(dot)com> |
---|---|
To: | pgsql-sql(at)postgresql(dot)org |
Subject: | |
Date: | 2016-06-02 21:31:17 |
Message-ID: | 6C9B51CF-C8D0-416A-986D-AE1615A01909@gmail.com |
Views: | Whole Thread | Raw Message | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-sql |
Hi All!
Why is too much difference in time execution between these two queries:
SELECT rc.id AS id, rc.name
FROM realisation_category rc
WHERE EXISTS (
SELECT * FROM realisation r, post p WHERE (r.realisation_category_id = rc.id AND r.site_id = 1)
OR (p.realisation_category_id = rc.id AND p.site_id = 1)
)
[2016-06-03 01:23:12] 35 row(s) retrieved starting from 1 in 14s 591ms (14s 612ms total)
SELECT rc.id AS id, rc.name
FROM realisation_category rc
WHERE EXISTS (
SELECT * FROM realisation r WHERE r.realisation_category_id = rc.id AND r.site_id = 1
) OR EXISTS (
SELECT * FROM post p WHERE p.realisation_category_id = rc.id AND p.site_id = 1
)
[2016-06-03 01:25:25] 35 row(s) retrieved starting from 1 in 64ms (86ms total)
Thanks
From | Date | Subject | |
---|---|---|---|
Next Message | Steve Midgley | 2016-06-03 00:28:05 | Re: |
Previous Message | Michael Moore | 2016-06-01 14:29:20 | Re: jdbc and postgresql function session question |