Thank you for your help, Tom.
You are right. I added an index on employee.name (by making it unique), and
then postgres can visit employee table in a pre-sorted manner, and can exit
early without joining more rows.
Just sharing the tweak I did to the example, if anyone else is interested
in a qu
WU Yan <4wu...@gmail.com> writes:
> Hello everyone, I am still learning postgres planner and performance
> optimization, so please kindly point out if I missed something obvious.
An index on employee.name would likely help here. Even if we had
an optimization for pushing LIMIT down through a join
Hello everyone, I am still learning postgres planner and performance
optimization, so please kindly point out if I missed something obvious.
I've noticed that postgres joins all rows in two tables, even though
there's a `limit` in the query. It means lots of joined rows are discarded
eventually, a