Josue'
> -> Index Scan using pkd_pcode_idx on pkardex (cost=0.00..11292.52
> rows=5831 width=72) (actual time=18.152..39520.406 rows=5049 loops=1)
Looks to me like there's a problem with index bloat on pkd_pcode_idx. Try
REINDEXing it, and if that doesn't help, VACUUM FULL on pkardex.
--
-Josh Berkus
Aglio Database Solutions
San Francisco