pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Pavel Stehule <pavel.stehule@gmail.com>
Cc: Silvio Moioli <moio@suse.de>
Cc: Pgsql Performance <pgsql-performance@lists.postgresql.org>
Subject: Re: Increasing work_mem slows down query, why?
Date: Mon, 30 Mar 2020 12:36:17 -0400
Message-ID: <19893.1585586177@sss.pgh.pa.us> (raw)
In-Reply-To: <CAFj8pRA+teK=u9ei82WXcxAXF2o+-6NShsKt8XBo20ycUcPVCQ@mail.gmail.com>
References: <79dd683d-3296-1b21-ab4a-28fdc2d98807@suse.de>
	<CAFj8pRDmvK8hZXLHs9hEEyEjVOWYw0=fUSirBKu5OV5qmiu7jg@mail.gmail.com>
	<6d829078-b34a-ca4d-909a-5427aa22ae47@suse.de>
	<CAFj8pRADkvF1BwpX7Dv3cYOkcEFAHNNcRX1rM3eqbkGe7rbTbg@mail.gmail.com>
	<18262.1585584121@sss.pgh.pa.us>
	<CAFj8pRA+teK=u9ei82WXcxAXF2o+-6NShsKt8XBo20ycUcPVCQ@mail.gmail.com>

Pavel Stehule <pavel.stehule@gmail.com> writes:
> CTE scan has only 1100 rows, public.rhnpackagecapability  has 490964 rows.
> But planner does hash from public.rhnpackagecapability table. It cannot be
> very effective.

[ shrug... ]  Without stats on the CTE output, the planner is very
leery of putting it on the inside of a hash join.  The CTE might
produce output that ends up in just a few hash buckets, degrading
the join to something not much better than a nested loop.  As long
as there's enough memory to hash the known-well-distributed table,
putting it on the inside is safer and no costlier.

			regards, tom lane





view thread (12+ messages)  latest in thread

Message-ID: <19893.1585586177@sss.pgh.pa.us>
Permalink:  ../19893.1585586177@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/19893.1585586177@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pavel.stehule@gmail.com, moio@suse.de, pgsql-performance@lists.postgresql.org
  Subject: Re: Increasing work_mem slows down query, why?
  In-Reply-To: <19893.1585586177@sss.pgh.pa.us>

* 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