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 1kX6Ab-0002zm-6F for pgsql-performance@arkaria.postgresql.org; Mon, 26 Oct 2020 17:20:33 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kX6Aa-0002ir-4p for pgsql-performance@arkaria.postgresql.org; Mon, 26 Oct 2020 17:20:32 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kX6AZ-0002ik-Ej for pgsql-performance@lists.postgresql.org; Mon, 26 Oct 2020 17:20:31 +0000 Received: from mail-qt1-x835.google.com ([2607:f8b0:4864:20::835]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1kX6AW-000789-0g for pgsql-performance@postgresql.org; Mon, 26 Oct 2020 17:20:30 +0000 Received: by mail-qt1-x835.google.com with SMTP id h19so7283915qtq.4 for ; Mon, 26 Oct 2020 10:20:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=entrata.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5g59/J7HVlHf2NxFV1dYFz07Zlak1J7m2VacN98lzSA=; b=amA9iX4w4g74n2QfaeQcDJFNmddHrN4G1UXWfc1MGgDzVaWJHT5FUKnJUKteDXP26V BSvJAs05bDZqAsZNarl0z8thFek4d8rmcu6FCqIFgU9ZHhvpIzVuC49LJCxXGEwAg0Nj 0PYauE5NqwzlioOl4wer5/P+o0mSxdIbQqbOuk/P3dPIfWYoQJ8bnDA45Z5+ED2UEtty XcbTRceO1zVmhq2w/me6LDEVz3acke9s0HsGTUu1xq/wC6KnhBmOxIuFBlLk0/8752jr jsPbRikD0s4iVnGGcwTHpP5993WQS1svJBhlMP7kSy2KLB0ggm9/iznTdMY7ELKkeq57 r6Mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5g59/J7HVlHf2NxFV1dYFz07Zlak1J7m2VacN98lzSA=; b=CMNq82Yt6wPKJVGZWxB0djwEp3X+494YNZv8coxq9Dsn78isBjAnYmucfcgzNDDbql zcjRtxCpdZ6v2loGVKFP9BxI28ZPmO6+DCXzkCDYPatRaP5whK04vZzCTjZKrkohciVK XhszBPydUQbvdlsNNjGr9wn+2/fZUnqXLLNLr5ZCcxJ5IIFtik+Ib2EtROd4IoV/fCWi zUnGpQfSiwAKPU0p4TQWMWj3Nn/2zGpr9zKoAzf6iRsSChj0+QgrLpVuniZ0xG4egR3X QlkUJy2qASLmwaZfO8SskxIHQDSqdeU7tjaxvQG44+GEBUsO/fYzVZveW+Oey5qyxpN0 om+Q== X-Gm-Message-State: AOAM533wE/kLJRq01ebuxrtnD9291Y4jup018XuHsP6yzaCw7dx97qpT pGg0rSTZjhk5r0uLQn8kqoCKmiU85KTqIhGiokSyaQ== X-Google-Smtp-Source: ABdhPJy+eyD7jAlniJowmxsL4YR8vJ8llagFi8ciYm6+5ZIekoVfDCmnwOfeE44RSaH51LLZ+uQx2jXLlHr2Woc3aYQ= X-Received: by 2002:ac8:690f:: with SMTP id e15mr3114455qtr.356.1603732826817; Mon, 26 Oct 2020 10:20:26 -0700 (PDT) MIME-Version: 1.0 References: <7AC7104E-E233-4CCA-B99E-12197D61A4DD@americanefficient.com> <20201026170405.GT9241@telsasoft.com> In-Reply-To: From: Michael Lewis Date: Mon, 26 Oct 2020 11:20:01 -0600 Message-ID: Subject: Re: Understanding bad estimate (related to FKs?) To: Philip Semanchuk Cc: Justin Pryzby , postgres performance list Content-Type: multipart/alternative; boundary="00000000000075248305b29625cd" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --00000000000075248305b29625cd Content-Type: text/plain; charset="UTF-8" On Mon, Oct 26, 2020 at 11:14 AM Philip Semanchuk < philip@americanefficient.com> 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? Have you tried to create extended statistics and see if the estimate changes? I believe that extended stats will not directly help with joins though, only group bys and perhaps choosing an index scan vs table scan when comparing the correlated columns to static values rather than joining up tables. Wouldn't be much effort to try it though. --00000000000075248305b29625cd Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Mon, Oct 26, 2020 at 11:14 AM Philip S= emanchuk <philip@america= nefficient.com> wrote:
>> The item I'm focused = on is node 23. The estimate is for 7 rows, actual is 896 (multiplied by 106= 2 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 =3D zulu_five.five_uniform) AND
>> (whiskey_mike =3D juliet_india.whiskey_mike) AND
>> (bravo =3D 'mike'::text)

Are the columns correlated? Have you tried to create extended statistics= and see if the estimate changes? I believe that extended stats will not di= rectly help with joins though, only group bys and perhaps choosing=C2=A0an = index scan vs table scan when comparing the correlated columns to static va= lues rather than joining up tables. Wouldn't be much effort to try it t= hough.
--00000000000075248305b29625cd--