2010/1/19 Philippe Lang <philippe.lang@xxxxxxxxxxxxxx>: > That works just fine, but is there maybe a way of creating a slighly > more "generic" index? If I change the ">" with a "<" in the query, index > cannot of course be used. According to documentation, answer seems to be > "no"... > You could create an index on the difference: create index long_transformation_index on indexed_table ((data1-this_is_a_long_transformation(data2))); then rewrite your queries accordingly: ... WHERE data1-this_is_a_long_transformation(data2) > some const (or < some const) HTH, Dean -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general