Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1b0VKQ-0005rz-Cc for pgsql-bugs@arkaria.postgresql.org; Wed, 11 May 2016 14:41:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1b0VKP-0004qD-Vf for pgsql-bugs@arkaria.postgresql.org; Wed, 11 May 2016 14:41:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1b0VKP-0004oY-36 for pgsql-bugs@postgresql.org; Wed, 11 May 2016 14:41:33 +0000 Received: from mail-wm0-x22a.google.com ([2a00:1450:400c:c09::22a]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84_2) (envelope-from ) id 1b0VKM-0001KD-Ky for pgsql-bugs@postgresql.org; Wed, 11 May 2016 14:41:32 +0000 Received: by mail-wm0-x22a.google.com with SMTP id g17so86690488wme.1 for ; Wed, 11 May 2016 07:41:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:cc:from:message-id:date:user-agent :mime-version:in-reply-to:content-transfer-encoding; bh=mQKWoTdRvB6tMbry/iXjg9I3y4Ed7uc7/e2NmrMIxjU=; b=PS1PGrAl36eaS9LCXywMcbbdWNyo0QrdWYWsnxYp3wMavOqUueIWRVbhO2fa17O16H tdgmF/Y0iN5qVlX06NFLk5OVEDVvvQvSMC9DkE6CDmWn7z38BB77cCxjvOH1FXxl9kPU ekL/M2Lsgx7ZbbZR9DCxEMWWg7rsk5tLadc4F/hOpoM+qJV4ZPprw0NjqGw+GycI87+8 ZB9SQ4sK0aMhbYtZMwCBtYXXDj2pp4MxAPFdN7zZL3dWICLCvjSj9LToRaFeIvWEahb1 sp4TjX4XOyOR1Vg0CzdVKkaZLwub8/kzD2aTNgyqcrmxc9oUR5F17gJbcnDAPPeF8zXu utJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:cc:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=mQKWoTdRvB6tMbry/iXjg9I3y4Ed7uc7/e2NmrMIxjU=; b=EdhzvYc/ScdYOeIDDMbGl6DR6MnoMjkkeuSotPkxBGG2QZJCie44vi6hWh3om+p4AF /RNgTOjGQeI1XAOREEs/JWkCp5XSHpegROB9ktVmKatyphCGQr+FfciZ9fMGpALf9YOw akw3ACFISAuLyz93wdIK63uNmIM3ZtK0CZkkESylwcRaTu3/nxmctaOuoskXdZXyOxx8 V6Jmo92LO3YTsl4FZS87RhdXcPOc0ffzErtYmLyc40HEu/DyIBE05DWTwZWnCmOK4Xau 5+J2fn+4OmUFs6wU2aCB8VilPjaXrDbOUct1eRfou4dlJV+S0/ejChZ557KXAO0JD2ct 9TRw== X-Gm-Message-State: AOPr4FX3hFgDa5vgW2SnRb3NP7OzP30J0F+gU23QNqa8L66SbIYiIoZWgHzgh+Fsq1FrKw== X-Received: by 10.194.173.42 with SMTP id bh10mr4656520wjc.150.1462977686874; Wed, 11 May 2016 07:41:26 -0700 (PDT) Received: from [192.168.1.144] (dsl-28-42.utaonline.at. [81.189.28.42]) by smtp.googlemail.com with ESMTPSA id m3sm8223332wjc.27.2016.05.11.07.41.25 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 11 May 2016 07:41:25 -0700 (PDT) Subject: Re: BUG #14107: Major query planner bug regarding subqueries and indices To: David Rowley References: <20160421115638.22895.78902@wrigleys.postgresql.org> <69e376c7-6c2c-c96d-2ad6-3734affb59b7@gmail.com> <44df2e58-87f5-282c-9871-c735240c55e4@gmail.com> <1461406942121-5900147.post@n5.nabble.com> <3ac6f379-08f8-d1db-639f-2dc3075d2eb4@gmail.com> <1461610493986-5900430.post@n5.nabble.com> <629ecf23-b7b2-2d73-6792-150b111e83ab@gmail.com> <18635.1461892238@sss.pgh.pa.us> Cc: Tom Lane , pgsql-bugs@postgresql.org From: Mathias Kunter Message-ID: Date: Wed, 11 May 2016 16:41:24 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org > How do you find the ANY(ARRAY(...)) version performs with say 10 > million records in the array? I've tested with a subquery which returns about 20 million different rows. In this case IN(...) is about 5 times faster than ANY(ARRAY(...)) for me. The exact numbers are: IN(...): about 22 seconds ANY(ARRAY(...)): about 115 seconds However, estimated query costs seem to be always correct. So shouldn't it be quite easy for the planner to create query plans for both the ANY(ARRAY(...)) and the IN(...) version and then just use the plan where costs are cheaper? -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs