From: | "Robert Haas" <robertmhaas(at)gmail(dot)com> |
---|---|
To: | "Adam Rich" <adam(dot)r(at)sbcglobal(dot)net> |
Cc: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: why hash on the primary key? |
Date: | 2008-11-29 13:29:18 |
Message-ID: | 603c8f070811290529r2ee32dceu4ddcd508c8456a02@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> Could you send the output of these two queries using "explain analyze"
> instead of plain explain?
portal=# explain analyze select * from foo i, foo j where i.id = j.id;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------
Hash Join (cost=747.87..2127.36 rows=13283 width=272) (actual
time=68.434..205.536 rows=13283 loops=1)
Hash Cond: (i.id = j.id)
-> Seq Scan on foo i (cost=0.00..315.83 rows=13283 width=136)
(actual time=0.024..23.349 rows=13283 loops=1)
-> Hash (cost=315.83..315.83 rows=13283 width=136) (actual
time=68.353..68.353 rows=13283 loops=1)
-> Seq Scan on foo j (cost=0.00..315.83 rows=13283
width=136) (actual time=0.009..23.839 rows=13283 loops=1)
Total runtime: 223.390 ms
(6 rows)
portal=# set enable_seqscan to false;
SET
portal=# explain analyze select * from foo i, foo j where i.id = j.id;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------
Merge Join (cost=0.00..2310.24 rows=13283 width=272) (actual
time=0.272..149.317 rows=13283 loops=1)
Merge Cond: (i.id = j.id)
-> Index Scan using foo_pkey on foo i (cost=0.00..1055.50
rows=13283 width=136) (actual time=0.205..29.714 rows=13283 loops=1)
-> Index Scan using foo_pkey on foo j (cost=0.00..1055.50
rows=13283 width=136) (actual time=0.025..37.534 rows=13283 loops=1)
Total runtime: 166.364 ms
(5 rows)
From | Date | Subject | |
---|---|---|---|
Next Message | Robert Haas | 2008-11-29 13:31:48 | Re: why hash on the primary key? |
Previous Message | Scott Marlowe | 2008-11-29 07:35:35 | Re: configure options |