On Sat, 5 Sep 2020 at 10:20, Nagaraj Raj <nagaraj.sf@xxxxxxxxx> wrote: > I added the index as you suggested and the planner going through the bitmap index scan,heap and the new planner is, > HaOx | explain.depesz.com In addition to that index, you could consider moving away from standard SQL and use DISTINCT ON, which is specific to PostgreSQL and should give you the same result. EXPLAIN ANALYZE SELECT DISTINCT ON (serial_no) serial_no,receivingplant,sku,r3_eventtime FROM receiving_item_delivered_received WHERE eventtype='LineItemdetailsReceived' AND replenishmenttype = 'DC2SWARRANTY' AND coalesce(serial_no,'') <> '' ORDER BY serial_no,eventtime DESC; The more duplicate serial_nos you have the better this one should perform. It appears you don't have too many so I don't think this will be significantly faster, but it should be a bit quicker. David