Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kXwVk-0003z5-3p for pgsql-performance@arkaria.postgresql.org; Thu, 29 Oct 2020 01:13:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kXwVi-0006Hc-TD for pgsql-performance@arkaria.postgresql.org; Thu, 29 Oct 2020 01:13:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kXwVi-0006HV-I8 for pgsql-performance@lists.postgresql.org; Thu, 29 Oct 2020 01:13:50 +0000 Received: from mail-io1-xd41.google.com ([2607:f8b0:4864:20::d41]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kXwVf-0007To-Ed for pgsql-performance@postgresql.org; Thu, 29 Oct 2020 01:13:49 +0000 Received: by mail-io1-xd41.google.com with SMTP id b15so1580489iod.13 for ; Wed, 28 Oct 2020 18:13:47 -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=Cwo8HsobTBZ/9HW4rXrctPBjjH8Sz5WcRmqIeZzfEuw=; b=Ijdz24rTXZOygXx0sZYlec+y+TK/jHgELlKDUm3IzBFrJTrNUTP6zKXykYuFuKER1C HkCK3Mm6r1dyHUCkLYo/E4ZfFuKXOujDNdXZv1OeZarCLHclZoK7fx0/2IlMY7TI+v/o U9B7seOu+LRlqEju9i92mv0/IP4zo3YvQ9v6QD9QXFGAPCVKH2s68Kadrt5ozVkKCnin Cl8byOKZAJvEMg/DwBZQPnO5811uIkA71Dq7L2eBRKYI/nwkTz7k2ABXJWPOmTLR6NKr r7xDa9wcf3VGYbfYRVMk0Ox/PIFAhW3J+d5S1kv1up+zrw07GGDsUErpebnFBprXriS9 ekIQ== 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=Cwo8HsobTBZ/9HW4rXrctPBjjH8Sz5WcRmqIeZzfEuw=; b=ndQKRWi4D2MFpx7LPKVjxbwzaQHD5bo53k+9gmBu/ng3KQ2osnZ4aKrZgsLas2zWM4 xldBs6rjs/QKuJ3gyTuZBd9D6SWQIe1Rz1sJ0Zp8FkdIE54LEEZysJH07He5ogk8/kI6 UsH2xgm9Qr1hgjkvPII+wRC43OJ4vrREClDDxNZY0/GEkK51SAvAbKIoljqo4sqGTNaO jWKRaDxbNlgaihRDy4NOYap9pdUx5V4rJ+j2tUVx0odRtc2UZUgBfteboAKeL9x8M+9Q G6MM0EzsRxxvT9qi+jvndNaJd/V1izGTalgSplo0sVsvcYoR4jDlwBAi+5UNXwMPwU4u bb5g== X-Gm-Message-State: AOAM532CV5geskW1qeR1L3L5yLXI7T0VIa27tzNZvhaD++VsF3K+DnK+ GYpeWZ37B8Hl3pMcqGvkSWR8pA== X-Google-Smtp-Source: ABdhPJwGf3K0sozphFDNBKmsX2K/yUBoGzkCJdjzCWTJjIssUPLJIza4w6dFVLzp3mvCLs9zSDtNdw== X-Received: by 2002:a6b:8ec7:: with SMTP id q190mr1741150iod.42.1603934025637; Wed, 28 Oct 2020 18:13:45 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id w15sm889073iom.6.2020.10.28.18.13.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Oct 2020 18:13:44 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id BCC37800747; Wed, 28 Oct 2020 20:13:43 -0500 (CDT) Date: Wed, 28 Oct 2020 20:13:43 -0500 From: Justin Pryzby To: Michael Lewis Cc: Philip Semanchuk , pgsql-performance@postgresql.org Subject: Re: Understanding bad estimate (related to FKs?) Message-ID: <20201029011343.GO5380@telsasoft.com> References: <7AC7104E-E233-4CCA-B99E-12197D61A4DD@americanefficient.com> <20201026170405.GT9241@telsasoft.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Mon, Oct 26, 2020 at 11:20:01AM -0600, Michael Lewis wrote: > On Mon, Oct 26, 2020 at 11:14 AM Philip Semanchuk wrote: > > > >> The item I'm focused on is node 23. The estimate is for 7 rows, actual > > is 896 (multiplied by 1062 loops). I'm confused about two things in this > > node. > > >> > > >> The first is Postgres' estimate. The condition for this index scan > > contains three expressions -- > > >> > > >> (five_uniform = zulu_five.five_uniform) AND > > >> (whiskey_mike = juliet_india.whiskey_mike) AND > > >> (bravo = 'mike'::text) > > > > Are the columns correlated? I guess it shouldn't matter, since the FKs should remove all but one of the conditions. Maybe you saw this other thread, which I tentatively think also affects your case (equijoin with nonjoin condition) https://www.postgresql.org/message-id/AM6PR02MB5287A0ADD936C1FA80973E72AB190%40AM6PR02MB5287.eurprd02.prod.outlook.com