I'm trying to create an optimized, partial index to find all rows where the numeric field amount is not zero.
This
CREATE INDEX amount_not_zero_idx ON my_table (amount)
WHERE amount <> 0;
is working, but it's not really what I have in mind as only the information "unlike zero" is important. What I would like to do is something like
CREATE INDEX amount_not_zero_idx ON my_table (amount <> 0)
WHERE amount <> 0;
as this should give the best performance - but PostgreSQL gives a syntax for the "<>" error.
Any suggestions?