From: | "Andrus" <kobruleht2(at)hot(dot)ee> |
---|---|
To: | pgsql-general(at)postgresql(dot)org |
Subject: | Re: simple query runs 26 seconds |
Date: | 2007-08-27 12:23:38 |
Message-ID: | faufou$2bq$1@news.hub.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
> Perhaps that table is bloated by lack of vacuuming --- can you
> show the output from "vacuum verbose rid"?
Thank you.
After running vacuum and analyze commands the query takes 18 seconds.
This is still very slow because my tables are indexed.
How to speed up this ?
set search_path to firma1,public;explain analyze select sum(taitmata) as
ukogus
from rid join dok using (dokumnr)
where toode='NE TR'
and doktyyp='U'
now returns:
"Aggregate (cost=52251.18..52251.19 rows=1 width=8) (actual
time=17898.967..17898.967 rows=1 loops=1)"
" -> Hash Join (cost=1182.35..52249.39 rows=715 width=8) (actual
time=4891.581..17898.897 rows=9 loops=1)"
" Hash Cond: (rid.dokumnr = dok.dokumnr)"
" -> Bitmap Heap Scan on rid (cost=777.92..51694.85 rows=22874
width=12) (actual time=24.079..17876.282 rows=21383 loops=1)"
" Recheck Cond: (toode = 'NE TR'::bpchar)"
" -> Bitmap Index Scan on rid_toode_idx (cost=0.00..772.20
rows=22874 width=0) (actual time=11.474..11.474 rows=21388 loops=1)"
" Index Cond: (toode = 'NE TR'::bpchar)"
" -> Hash (cost=365.33..365.33 rows=3128 width=4) (actual
time=0.104..0.104 rows=7 loops=1)"
" -> Index Scan using dok_tasudok_unique_idx on dok
(cost=0.00..365.33 rows=3128 width=4) (actual time=0.058..0.089 rows=7
loops=1)"
" Index Cond: (doktyyp = 'U'::bpchar)"
"Total runtime: 17899.582 ms"
Andrus.
From | Date | Subject | |
---|---|---|---|
Next Message | Marcelo de Moraes Serpa | 2007-08-27 12:40:45 | [ERROR] syntax error at end of input |
Previous Message | Sanjay | 2007-08-27 12:21:48 | EXPLAIN ANALYZE not considering primary and unique indices! |