Postgresql 9.5 BRIN index dramatically slower than expected
I'm guessing when migrating you didn't import rows ordered by date. You could check this by issuing

select * from logline; 


And check if date looks like it's increasing monotonically. If that's not the case, you could try sorting the table, for example:

select * into logline2 from logline order by date asc;


... create index on second table ...

CREATE index logline2_date_brin on logline2 using BRIN(date)


... and try 'luck' with second table:

EXPLAIN ANALYZE SELECT COUNT(*) from logline2 where date BETWEEN '2016-01-15' and '2016-01-31';


If the time is drastically better, perfect.



If you have disk space limitations, you should also check extension cstore_fdw. It's really good for analytics and can store data in compressed form. It features indexing similar to BRIN, but has some limitations: you can only append data and transactions are not supported.