CN writes: > Table1 contains 9000 rows and table2 contains 0 row. This query, which > takes 13489 msec, is extremely slow as pgsql sequentially scans all rows > in table1: > > EXPLAIN ANALYZE SELECT COUNT(*) FROM view1;
Unqualified count() cannot use an index because it has to visit all the rows in the table. Then again, I don't quite believe that visiting 9000 rows takes 13 seconds. Can you show us the result of EXPLAIN ANALYZE and your real table and view definitions, because the ones you showed contained a few syntax errors. -- Peter Eisentraut [EMAIL PROTECTED] ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings
