Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b8c5T-0002tx-Uf for pgsql-sql@arkaria.postgresql.org; Thu, 02 Jun 2016 23:31:40 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1b8c5T-0004K5-HQ for pgsql-sql@arkaria.postgresql.org; Thu, 02 Jun 2016 23:31:39 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1b8aD7-0005fY-SU for pgsql-sql@postgresql.org; Thu, 02 Jun 2016 21:31:26 +0000 Received: from mail-lf0-x22b.google.com ([2a00:1450:4010:c07::22b]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1b8aD5-0007dQ-1g for pgsql-sql@postgresql.org; Thu, 02 Jun 2016 21:31:24 +0000 Received: by mail-lf0-x22b.google.com with SMTP id s64so42610027lfe.0 for ; Thu, 02 Jun 2016 14:31:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:content-transfer-encoding:subject:message-id:date:to :mime-version; bh=8FLW31zz+3wmz/THit8j40ofIOZGYzLmm0MpiVAcW9E=; b=U9lP01sgY/oCbYAyWcAwLJ0ssozbq8G9c+geslLuJlmTyw05QqsJei7K0ZwkJBPNHV N5pCr7eSoQ1ACgE+04zkQQVJTEj4D4uBVaNJ/bkIb+i1Zn1Ma9+GohW5BEZDvqO4SmhO 4QBBUXS954Hk/ZRZNZTbrTdPP7+QsqKjYO6K52fDXixojUi3ah0e4HgyOr3dn5h9cTdm 4CjbTEJ9jkHUbo0YR50xnPZlRfvgr/IPNKxs0jlF1nVvTcfTDyHRTMwhBcnWYypgKNhc xi2alKsYZeVO+zfP0NyY53gyzfmTIzsNfZ/Tftv5cQ1mV1wTcr14ddG15hS26cUumoFx t3hA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:content-transfer-encoding:subject :message-id:date:to:mime-version; bh=8FLW31zz+3wmz/THit8j40ofIOZGYzLmm0MpiVAcW9E=; b=W1vpbe7Twj/1ZyVFiNnLtc6v7xTZ2IHP5Vda2GaFnbs/CKcnntLrUQ8A8ZXjnbTotm RXqSqZyl5uqLvl7hdlhfu+Y6+UhmFD+0MZtpykR+fW4aqDGwaequKtAP/eAZtm1sum7M KNeAJPkNnX98dXSY7PFreBhg3TXKEx5VxxtYNLo0qGDllXa0jp1RaPXYqE4k3N2hxCIj Ln8PA1IF8L7nrEfcFdq30xg+eXH7DOsw8n0Q9eZrm1/kaExHjJaEnYrjZE3XNzCnZOdS r7E1g6whkazHSrBP2nmZ5tHmx6b89W0DQdJRqaxBvBa69k/d38zsqc6glqoiYcCZYunP +6HA== X-Gm-Message-State: ALyK8tLq/imh1F3PEi2jR+AxOAVF8bAihsQerfLKzsID702AFKW2Q8l4cx+DjH/faDi3BA== X-Received: by 10.25.162.130 with SMTP id l124mr68735lfe.175.1464903080600; Thu, 02 Jun 2016 14:31:20 -0700 (PDT) Received: from [192.168.1.44] ([5.18.52.191]) by smtp.gmail.com with ESMTPSA id e10sm202655lbf.26.2016.06.02.14.31.19 for (version=TLS1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 02 Jun 2016 14:31:19 -0700 (PDT) From: Max Lipsky Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Subject: Message-Id: <6C9B51CF-C8D0-416A-986D-AE1615A01909@gmail.com> Date: Fri, 3 Jun 2016 00:31:17 +0300 To: pgsql-sql@postgresql.org Mime-Version: 1.0 (Mac OS X Mail 9.3 \(3124\)) X-Mailer: Apple Mail (2.3124) X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org 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 = =3D rc.id AND r.site_id =3D 1) OR (p.realisation_category_id =3D rc.id AND p.site_id =3D 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 =3D rc.id A= ND r.site_id =3D 1 ) OR EXISTS ( SELECT * FROM post p WHERE p.realisation_category_id =3D rc.id AND p.si= te_id =3D 1 ) [2016-06-03 01:25:25] 35 row(s) retrieved starting from 1 in 64ms (86ms tot= al) Thanks --=20 Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql