I have BIG table with multiple indexes in postgres. It has indexes on db_timestamp, id, username.
I want to find the MAX timestamp for particular username. The problem is the simple query like
SELECT MAX(db_timestamp) FROM Foo WHERE username = 'foo'
takes so much time because of the huge table size( we are talking 450GB table with over 30 GB index sizes).
Is their any way to optimize this query or tell postgres about what query plan to use?