Re: further explain changes

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Jaime Casanova <jcasanov(at)systemguards(dot)com(dot)ec>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: further explain changes
Date: 2010-01-31 05:27:27
Message-ID: 603c8f071001302127j27c843bdnce8ea27a5dc56412@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Jan 30, 2010 at 12:26 PM, Jaime Casanova
<jcasanov(at)systemguards(dot)com(dot)ec> wrote:
> On Thu, Jan 28, 2010 at 4:18 PM, Robert Haas <robertmhaas(at)gmail(dot)com> wrote:
>> On Sun, Jan 24, 2010 at 12:30 PM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
>>>> On Sun, Jan 24, 2010 at 12:06 AM, Jaime Casanova
>>>>> why not let it go in ANALYZE, just as the sort info
>>>
>>>> It's kinda long-winded - it adds like 4 extra lines for each hash
>>>> join.  I don't think I want to add that much clutter to regular E-A
>>>> output.
>>>
>>> Well, that would only happen if you're deliberately obtuse about the
>>> formatting.  The sort code manages to fit all the extra on one line,
>>> and I don't see why hash couldn't.
>>
>> OK, here's a new version.
>>
>
> OK, i have 3 hashes in a query and i got these 3 lines in an EXPLAIN
> ANALYZE with your patch
> """
>                        ->  Hash  (cost=3878.94..3878.94 rows=83594
> width=34) (actual time=504.648..504.648 rows=83594 loops=1)
>                                 Buckets: 2048  Batches: 8  Memory Usage: 589kB
> [...]
>                     ->  Hash  (cost=14.49..14.49 rows=649 width=15)
> (actual time=2.901..2.901 rows=649 loops=1)
>                           Buckets: 1024  Batches: 1  Memory Usage: 32kB
> [...]
>               ->  Hash  (cost=977.62..977.62 rows=6555 width=16)
> (actual time=60.913..60.913 rows=6556 loops=1)
>                     Buckets: 1024  Batches: 1  Memory Usage: 308kB
> """
>
> I guess Memory Usage is per Batch, right? is this an average?

It's the maximum memory every used by that hash.

> What is the unit measure for Bucket?

There is no unit - it's just how many buckets.

> there are 14 temp files generated for this query and the only Sort
> says it was on memory so these files should come from the hashes, can
> we say that in the explain analyze?

I think maybe it's 2 temp files per batch in excess of 1, thus (8 - 1)
x 2 = 14 for the 8-batch join and none for the other two. Perhaps
you'd care to test that hypothesis?

> mmm... that memory usage, could be
> Disk actually?

No.

...Robert

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Guillaume Lelarge 2010-01-31 08:34:32 Using the new libpq connection functions in PostgreSQL binaries
Previous Message Hitoshi Harada 2010-01-31 04:47:46 Re: ordered aggregates using WITHIN GROUP (was Re: can somebody execute this query on Oracle 11.2g and send result?)