Andrus Moor wrote > Table has both indexes present but postgres will not use them. > Indexes can changed and query can re-written if this helps. > Table structure cannot changed. char columns cannot replaced with varchar > columns. kuupaev must be date and kellaaeg must be char(5) type. Don't discard the option to add additional trigger-maintained columns to the table and then modify the where clause to use those new columns while still outputting the originals. You also need to explain whether you can update from 9.0.3 to 9.0.18 As Craig Ringer already said working with seldom used types in unusual ways on ancient releases means that you may be stuck with second rate workarounds or just living with the performance degradation. I guess at worse you could delete data so the scan doesn't take as long... David J. -- View this message in context: http://postgresql.1045698.n5.nabble.com/How-to-find-greatest-record-before-known-values-fast-tp5821461p5821523.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general