pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrei Zhidenkov <andrei.zhidenkov@n26.com>
To: Игорь Выскорко <vyskorko.igor@yandex.ru>
Cc: pgsql-general@lists.postgresql.org
Subject: Re: Weird seqscan node plan
Date: Tue, 26 Nov 2019 10:02:44 +0100
Message-ID: <DA490E2B-49FB-4AE4-9134-28CC3157F2B2@n26.com> (raw)
In-Reply-To: <154007751574734779@myt2-a7d7570d35ff.qloud-c.yandex.net>
References: <154007751574734779@myt2-a7d7570d35ff.qloud-c.yandex.net>

How many tables do you have in your query? If too many, in your case “Genetic Query Optiomiation” might be used (https://www.postgresql.org/docs/10/geqo-pg-intro.html <https://www.postgresql.org/docs/10/geqo-pg-intro.html;).

> On 26. Nov 2019, at 03:19, Игорь Выскорко <vyskorko.igor@yandex.ru> wrote:
> 
> Hi all!
> I'm confused by planner choice: seqscan but not index scan when index scan cost is much cheaper.
> 1st plan: https://explain.depesz.com/s/Cti#l8
> 2nd plan (with "set enable_seqscan = off"): https://explain.depesz.com/s/qn0I#l8
> 
> Look at 8th row: this nested loop decided to join the second node by using seqscan (1st plan) when index is available (2nd plan). Index scan is much cheaper (0.430 over 257.760). 
> 
> What am I missing?
> 
> And thanks for any reply!
> 
> 

view thread (7+ messages)  latest in thread

Message-ID: <DA490E2B-49FB-4AE4-9134-28CC3157F2B2@n26.com>
Permalink:  ../DA490E2B-49FB-4AE4-9134-28CC3157F2B2@n26.com/
Also on:    postgresql.org/message-id/DA490E2B-49FB-4AE4-9134-28CC3157F2B2@n26.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: andrei.zhidenkov@n26.com, vyskorko.igor@yandex.ru
  Subject: Re: Weird seqscan node plan
  In-Reply-To: <DA490E2B-49FB-4AE4-9134-28CC3157F2B2@n26.com>
  References: <154007751574734779@myt2-a7d7570d35ff.qloud-c.yandex.net> <DA490E2B-49FB-4AE4-9134-28CC3157F2B2@n26.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox