agora inbox for pgsql-sql@postgresql.org  
help / color / mirror / Atom feed
From: Max Lipsky <maxlipsky@gmail.com>
To: pgsql-sql@postgresql.org
Date: Fri, 3 Jun 2016 00:31:17 +0300
Message-ID: <6C9B51CF-C8D0-416A-986D-AE1615A01909@gmail.com> (raw)
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-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

-- 
Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-sql



view thread (5+ messages)  latest in thread

Message-ID: <6C9B51CF-C8D0-416A-986D-AE1615A01909@gmail.com>
Permalink:  ../6C9B51CF-C8D0-416A-986D-AE1615A01909@gmail.com/
Also on:    postgresql.org/message-id/6C9B51CF-C8D0-416A-986D-AE1615A01909@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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: maxlipsky@gmail.com
  Subject: Re: 
  In-Reply-To: <6C9B51CF-C8D0-416A-986D-AE1615A01909@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 agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox