HNHacker News
TopNewBestAskShowJobs

interactive_rep

4 karma · joined January 27, 2014

submissionscomments
interactive_rep··on Count distinct performance compared on top 4 SQL databases
Another reason postgres could be running very slow, is that it may be spooling the intermediate result to a temp file on hard disk.

Do you see a performance increase when using SSD Drives?

interactive_rep··on Count distinct performance compared on top 4 SQL databases
One of the reasons you are seeing that the subquery runs twice as fast on most of the databases ( like SQL server, oracle & MySQL), is that it is able to execute the query with one pass through of the data. When it is taking twice as long (without the subquery), it is doing a second pass for the count distinct.