Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YLfI6-0002IH-H8 for pgsql-bugs@arkaria.postgresql.org; Wed, 11 Feb 2015 21:57:50 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YLfI5-0005mo-IC for pgsql-bugs@arkaria.postgresql.org; Wed, 11 Feb 2015 21:57:49 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YLfI4-0005l3-Ox for pgsql-bugs@postgresql.org; Wed, 11 Feb 2015 21:57:48 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YLfI1-0008O6-Ba for pgsql-bugs@postgresql.org; Wed, 11 Feb 2015 21:57:47 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id t1BLvdN2013814; Wed, 11 Feb 2015 16:57:39 -0500 From: Tom Lane To: toruvinn@lain.pl cc: pgsql-bugs@postgresql.org Subject: Re: BUG #12763: Planner refuses to do index-only-scan on partial indexes despite having all the required data In-reply-to: <20150211212848.5126.51787@wrigleys.postgresql.org> References: <20150211212848.5126.51787@wrigleys.postgresql.org> Comments: In-reply-to toruvinn@lain.pl message dated "Wed, 11 Feb 2015 21:28:48 +0000" Date: Wed, 11 Feb 2015 16:57:39 -0500 Message-ID: <13813.1423691859@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) 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 toruvinn@lain.pl writes: > johto told me on irc it may be worth reporting it here - thanks! Not really. See comment in check_index_only(): /* * Check that all needed attributes of the relation are available from the * index. * * XXX this is overly conservative for partial indexes, since we will * consider attributes involved in the index predicate as required even * though the predicate won't need to be checked at runtime. (The same is * true for attributes used only in index quals, if we are certain that * the index is not lossy.) However, it would be quite expensive to * determine that accurately at this point, so for now we take the easy * way out. */ This is the same reason why expression indexes are difficult to use in index-only scans: if the query refers to f(x), the information available to check_index_only() says that the index must be able to return the value of "x", not "f(x)". It'd be nice to improve, but the only obvious ways to do that would result in entirely unacceptable hits to planning speed. regards, tom lane -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs