Josue'
> dbmund=# explain analyze select * from vkardex where kprocode='1013';
> Nested Loop (cost=0.00..2248.19 rows=403 width=114) (actual
> time=846.318..16030.633 rows=3145 loops=1)
> -> Index Scan using pkd_pcode_idx on pkardex (cost=0.00..806.27
> rows=403 width=72) (actual time=0.054..87.393 rows=3544 loops=1)
> Index Cond: ((pkd_pcode)::text = '1013'::text)
> -> Index Scan using pdc_pk_idx on pmdoc (cost=0.00..3.55 rows=1
> width=50) (actual time=4.482..4.484 rows=1 loops=3544)
> Index Cond: (pmdoc.pdc_pk = "outer".doctofk)
> Total runtime: 16033.807 ms
Huh? It is not at all the same. Your index scan is down to 87ms from
27,000! And the total query is down to 16seconds from 47 seconds. Don't
you consider that an improvement?
--
-Josh Berkus
Aglio Database Solutions
San Francisco