Re: General performance/load issue - Mailing list pgsql-general

From Tomas Vondra
Subject Re: General performance/load issue
Date
Msg-id 4ED18420.3090803@fuzzy.cz
Whole thread Raw
In response to Re: General performance/load issue  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-general
On 26.11.2011 19:08, Tom Lane wrote:
> Tomas Vondra <tv@fuzzy.cz> writes:
>> Anyway the output is a bit strange. It's writing a lot of temp files
>> that are significantly smaller (about 3MB) than work_mem (128MB).
>
> The most obvious guess about what's doing that is a hash join that has
> a drastic overestimate of how many rows it has to hash, so that it's
> batching the join unnecessarily.  AFAIR, sorts don't spill to disk until
> they've actually reached work_mem, but hash join works differently.

OK, so it probably is not sorting, probably. What about other nodes
using hash table - aggregates etc.? Would those spill to the disk in
case of overestimation?

Gaetan did not post the whole query, but it starts like this:

SELECT COUNT(*) FROM (SELECT DISTINCT "table"."id" AS "id",
"table"."flux_id" AS "flux_id", "table"."locale_id" AS "locale_id",
...

so it obviously uses a DISTINCT clause, probably evaluated using a hash
aggregate. And this is allegedly one of the queries that write a lot.

Tomas

pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: How to add conversion between LATIN1 and WIN1251 ?
Next
From: Richard Greenwood
Date:
Subject: text search synonym dictionary anomaly with numbers