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 1ir7yV-000303-F9 for pgsql-performance@arkaria.postgresql.org; Mon, 13 Jan 2020 22:14:19 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1ir7yU-0002sw-2E for pgsql-performance@arkaria.postgresql.org; Mon, 13 Jan 2020 22:14:18 +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 1ir7yT-0002sS-J8 for pgsql-performance@lists.postgresql.org; Mon, 13 Jan 2020 22:14:17 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1ir7yQ-0007dr-JW for pgsql-performance@lists.postgresql.org; Mon, 13 Jan 2020 22:14:16 +0000 Received: by mail-wr1-x444.google.com with SMTP id y11so10266930wrt.6 for ; Mon, 13 Jan 2020 14:14:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=nCdH2znhOerG/VTDDK7fCrETX+o/2OxiYbtNUAHGArA=; b=WnhKS6DTteCwekThgZY59D6rFxbzq9sCKLB42YsbiyHBXL/WLKC8vcogdwZql0sWUf xIGduoZuULXUWlz9gHZ7LrkkrYKiUj5lHBcl/onqslBKnEbrSNzvv3f9DoDlH4zSWVa4 qhaINCKedh+L0BR526qnSlE2U4ZhnwBhel+TL2ndvekaIGo8cnKyYk2UVmmVg7U8MSDH QSAoaiCJwvoWP9GgqLtpaIpP72vd/+HPUmDihfrGP9ktngNgL4HnU7SX7/PpRjD5ltPG wgD5i8FO/okk7Jo5pAUu6yZm8xwtRPAANYNEPTXD3YfWpTZYnksWIrjG4nAyu3pyJeDF 1C6w== 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; bh=nCdH2znhOerG/VTDDK7fCrETX+o/2OxiYbtNUAHGArA=; b=hdcGGyH0P9Hv084rZ6myG8K64yYIAA5af4IdnzgMhoHFDj8Q2U6j/lQYUy5+5maYxD nFTXnlyXt0lKRNYLanIAIt3ntwL1eTyKKxsrWXP85IMfuqqgcToK1+M9KwrnAxopITgY Timb2pUB470U82tEMaJxxCLy3hlKo36zY12hHseHrcMu2B90DvYzA1/2xkoj6Ak4FcJL NIbw1rrMNyvcv5QeAzMajUWYqOLLA8H9aVS83kKJTUOlF4svt7YL5cyB7gYwS7KnHJei h9n8b2IxjhbXd9tIi5D1IDMYxafJ/OEwJwGhhxEaPeRYiyLsx6dfLYQaKB1b2gVg1YO0 agew== X-Gm-Message-State: APjAAAUnmF4Sq/GsIsznAY696WpXYNpeHEVx9rBuLo5BJcoYBNZC9lHH 9ai1r4+CSWTTSh8EPx7ez9UOfQ== X-Google-Smtp-Source: APXvYqxEfBkGpqOdBVZppvgGI6D7v6UMvJ6AL91WjHyrP9R69q6DVzf3GM7gxUFMWIblv1zrlKJ3SQ== X-Received: by 2002:a5d:67c7:: with SMTP id n7mr20926267wrw.319.1578953653781; Mon, 13 Jan 2020 14:14:13 -0800 (PST) Received: from localhost (ip-86-49-253-92.net.upcbroadband.cz. [86.49.253.92]) by smtp.gmail.com with ESMTPSA id r6sm17167627wrq.92.2020.01.13.14.14.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Jan 2020 14:14:13 -0800 (PST) Date: Mon, 13 Jan 2020 23:14:11 +0100 From: Tomas Vondra To: Marco Colli Cc: Justin Pryzby , pgsql-performance@lists.postgresql.org Subject: Re: Bad query plan when you add many OR conditions Message-ID: <20200113221411.sm5dm6fol3uwbuyp@development> References: <20200110030601.GH12066@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Fri, Jan 10, 2020 at 02:30:27PM +0100, Marco Colli wrote: >@Justin Pryzby I have tried this as you suggested: > >CREATE STATISTICS statistics_on_subscriptions_project_id_and_tags ON >project_id, tags FROM subscriptions; >VACUUM ANALYZE subscriptions; > >Unfortunately nothing changes and Postgresql continues to use the wrong >plan (maybe stats don't work well on array fields like tags??). > We support this type of clause for extended statistics (yet). regards -- Tomas Vondra http://www.2ndQuadrant.com PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services