Simple avg query on large table much slower in PostgreSQL than SQL Server
In PostgreSQL 9.6 Date constructors were fixed.


  Improve speed of the output functions for timestamp, time, and date data types (David Rowley, Andres Freund)


You can see the commit fest for this here. It's roughly 20x faster. In addition 9.6 supports parallel sequential scans. So this may be 20x faster on a single core. And, the whole scan may be able to use all of the cores on your system.


Download 9.6
Try again.
Get back with the results.