[postgis-users] OT Understanding slow queries
fork
forkandwait at gmail.com
Thu Aug 25 08:15:26 PDT 2011
Charles Galpin <cgalpin <at> lhsw.com> writes:
> explain select count(l.*)
> from links l, source_link ld where l.link_id = ld.link_id;
Can you try this returning some sort of value (like the keys) instead of a
count(*)? count(*) can be pretty slow in Postgres, sometimes
(I think) forcinga seq scan.
I am not particularly confident this will fix your problem,
but it is worth a shot.
I would also experiment with DISTINCT and LIMIT, after
making sure ANALYZE has been run appropriately.
More information about the postgis-users
mailing list