>>Can you post your exact query, the CREATE table structure and what indexes do you have. Also try the row_number() idea, though I think it should perform with the same speed as GROUP BY.
>
>This query is confidential. So, I cannot post it online. Also, as for your solution, I am not there yet. This query is the most complex query I have in this entire application. It contains several sub levels of select. So, we cannot touch that part. We can just work on this as encapsulated in order to achieve an additional request the client has asked. It contains about 40 lines. So, I am working on Sergey's approach first. If it doesn't work, I will consider something else.
BTW, you didn't answer my question from another message. Do you want to get a record with a minimum ChildField or apply different logic for 1 and other values?
If it's not broken, fix it until it is.
My Blog