Merlin,
> -> Index Scan using product_structure_file_pkey on
> product_structure_file (cost=0.00..45805.23 rows=5722 width=288)
> (actual time=0.063..0.063 row
> s=1 loops=1)
It appears that your DB is estimating the number of rows returned much too
high (5722 instead of 1). Please raise the statistics on all columns to
about 500, analyze, and try your test again.
Thanks!
--
--Josh
Josh Berkus
Aglio Database Solutions
San Francisco