Query to get count of inserted records hourly wise in postgresql?

Postgres can truncate a date to a certain precision:

SELECT DATE_TRUNC('hour', creation_date) FROM demo

So all you have to do is group and count it:

SELECT DATE_TRUNC('hour', creation_date), COUNT(*) 
FROM demo 
GROUP BY DATE_TRUNC('hour', creation_date)