Hi!
I've have this table:

TABLE BB : There isn't any primary key, and is it more or less order  (I mean, tt always is increased in each row, and id is nearly ordered)
ex:

id, op, atr, tt

1   0    X,   1
2   0    A   3
3   0   X    5
..........
1   0   X   51
.......
85  1    l   150
86  2   po 155
2    0   X   178
87  3   1   189
....

I VACUUM ANALYZE each 10.000 inserts more or less
in my case op only can have 3 values;
I've created an index on (id,op,tt) to improve the next query, that is executed very often:
"SELECT * FROM BB WHERE id="+ id+" AND op=0 order by tt desc;";
(because the only row I need is the one that has the highest tt)

but, after an hour running the program (more than 90.000 rows), I stopped it and
"EXPAIN SELECT * FROM BB WHERE id="+ id+" AND op=0 order by tempst desc;";
But, my sorprise was that the index wasn't be used. Always do a Seq Scan.

Have I to define the index in other columns? Have I to VACUUM ANALYZE more often?

There is other option to avoid the sort that is done because of ORDER BY?

Thanks a lot

yours,

Cris..