Karl,
> SubPlan
> -> Seq Scan on forumlog (cost=0.00..1.18 rows=1 width=8)
> Filter: ((login = '%s'::text) AND (forum = '%s'::text) AND
(number = $0))
> Why is the subplan using a sequential scan? At minimum the index on the
> post number ("forumlog_number") should be used, no? What would be even
> better would be a set of indices that allow at least two (or even all three)
> of the keys in the inside SELECT to be used.
It's using a seq scan because you have only 1 row in the table. Don't
bother testing performance before your database is populated.
PostgreSQL doesn't just use an index because it's there; it uses and index
because it's faster than not using one.
If there is more than one row in the table, then:
1) run ANALYZE forumlog;
2) Send us the EXPLAIN ANALYZE, not just the explain for the query.
--
-Josh Berkus
Aglio Database Solutions
San Francisco