There are some changes to the query plan and execution in most of the queries above if you tinker with: enable_seqscan random_page_cost seq_page_cost enable_hashjoin enable_mergejoin enable_nestloop
There are also some other ways to write the query to get a different plan and execution. But the way I have it here is representative of real world problems that we are experiencing now.