From: "Paul Mamin" <magamos@mail.ru>
> Under Postgres I filled this table by COPY FROM cause.
>
> And I made the SELECT that browse the whole table:
> -----
> select field1, sum(field2-field3)/count(*)
> from table1
> group by field1;
> -----
> 1) It's speed almost doesnt depend from index on field1.
Since you'll be accessing all the records anyway, I'm not sure use of an
index would make sense. Try EXPLAIN SELECT ... to see what postgesql thinks
is happening.
> 2) I made VACUUM ANALYZE
Well - PG knows the shape of the tables then.
> And ... MSSQL 7.0 worked in 2-2.5 times faster that Postgres :((
Can't really say - could be count(*) isn't being cached. Could be MSSQL is
just more efficient at this query. Bear in mind that MS may not be popular
with everyone, but their developers aren't idiots.
Post the output of the EXPLAIN and we'll see if PG is making any odd
assumptions.
- Richard Huxton