Sumeet Shukla <sumeet.k.shukla@gmail.com> writes:
> Yes, but when I actually execute the query in pgAdmin3, it takes exactly
> the same time of 19.5 secs.
pgAdmin is well known to be horribly inefficient at displaying large
query results (and 121788 rows qualifies as "large" for this purpose,
I believe). The circa-tenth-of-a-second savings on the server side
is getting swamped by client-side processing.
It's possible that pgAdmin4 has improved matters in this area.
regards, tom lane