Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iJIdR-0004YS-Hd for pgsql-performance@arkaria.postgresql.org; Sat, 12 Oct 2019 14:44:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iJIcS-0003xx-Ap for pgsql-performance@arkaria.postgresql.org; Sat, 12 Oct 2019 14:43:44 +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_SHA1:256) (Exim 4.89) (envelope-from ) id 1iJIcR-0003xd-Ss for pgsql-performance@lists.postgresql.org; Sat, 12 Oct 2019 14:43:44 +0000 Received: from mail-io1-xd44.google.com ([2607:f8b0:4864:20::d44]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iJIcO-0002Fx-GS for pgsql-performance@postgresql.org; Sat, 12 Oct 2019 14:43:43 +0000 Received: by mail-io1-xd44.google.com with SMTP id n26so27563134ioj.8 for ; Sat, 12 Oct 2019 07:43:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=yttTTxVPV7OczBEsRLD/LnKVXfDwZYKNsUIEJkAoQBA=; b=sH9fsMmTjgeSScwPQqQSO+AvTHe+vgORBwR7vU6CPUApsgpQJRtiBFtHPCUJb4kKIW J5l3bNTJkEl/Ju34mAK/pBvMQ5wB2s9Uj6yjE3RXpI+OKWvosmptheRvl4p1iNr/y2wv 9FyD7nSH4HrPUdOAJaQ8Dk8JlTnAJjnMo7PK+2ZTpy8NRE9yGnBNSmAaAOUW39L9Cb+a 1gE/5ZKRzlm2+nm0TyQxaPU5aTnB9ddsxEgsiMH0mgmyU00mHILAO9Pix742guZHrovO kcPZW0vpFCoCCRiN3vZqir7sDOaHSVPy4konjcbi03ItLWBxR2qWCmtxZC81QHB4GxuQ ZfHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=yttTTxVPV7OczBEsRLD/LnKVXfDwZYKNsUIEJkAoQBA=; b=akxXXcbCSYbBgOnWaQhcRMKQeL2dW9QLqG3MqqN9nAxsG0WQ1EdOlVDqPIB0Pjy4LJ rpAhj1k3Kg32wyNBc2w8wNMZpLlkJDOiE5r2nlulVp3zX66s20qunJEdlaYOUFpZFe6l Gp4HhMc5KJNliBV1VXxV3zApjzGjyN1bUfhDK/XIP14YJlod2Q/3myLR/xML1CtzfGAm /PxdJeaR52f76TKiinbF3QUK/paht8YDMIqRE5M0r84UG7NqwTH649xMB56vO4tjYPum DEnJySGzGMRZoJkUMFd8KtTZnpC/OKQCm//zLgQ3ZwKfSwCdzlyliMe3+My2FGbo76+N WiXA== X-Gm-Message-State: APjAAAV6CvHnpdng8lzL3fvKu/vmBLIU1lSwep0y99dW4QCSkbu338Ul dIKP83O45oTGBbN0dXizgXgdKg== X-Google-Smtp-Source: APXvYqz/eT30eLvxGTWBbM5ylviIBMLIUVHKGQDXsiK7ISN4BLG4pn6COGd7xoeDTK9arc7Yp4quLw== X-Received: by 2002:a5d:8242:: with SMTP id n2mr4095113ioo.139.1570891418521; Sat, 12 Oct 2019 07:43:38 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id t16sm8881421iol.12.2019.10.12.07.43.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 12 Oct 2019 07:43:37 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 8909B801AA1; Sat, 12 Oct 2019 09:43:36 -0500 (CDT) Date: Sat, 12 Oct 2019 09:43:36 -0500 From: Justin Pryzby To: Ivan Voras Cc: postgres performance list Subject: Re: Optimising a two column OR check Message-ID: <20191012144336.GA4475@telsasoft.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Sat, Oct 12, 2019 at 04:39:56PM +0200, Ivan Voras wrote: > With seqscan disabled, I get this plan on 9.6: > Bitmap Heap Scan on friend (cost=8.42..19.01 rows=14 width=8) ... > I expected to get an index-only scan in this situation, as that would be a > very common query. Is there a way to actually make this sort of query > resolvable with an index-only scan? Maybe a different table structure would > help? The v11 release notes have this relevant item: https://www.postgresql.org/docs/11/release-11.html |Allow bitmap scans to perform index-only scans when possible (Alexander Kuzmenkov) Justin