News for hackers. Stuff that matters.
Re:Amazon Redshift - What You Need To Know by stevoski on Sunday September 29, 2013 @05:58PM (#6466698)
select count( * ) from dummy_table;

takes 10 minutes on PostgreSQL to return the result 21454134?

With H2, an open source embedded SQL database I use daily, a "select count( * ) from table_name" query returns the result instantly. I assumed therefore that this was the norm...

Re:Amazon Redshift - What You Need To Know by saurik on Sunday September 29, 2013 @09:11PM (#6467271)
As mentioned by sargun (who was irritatingly downvoted by someone) the difference is that PostgreSQL uses the MVCC concurrency model, which allows you to do quite complex queries concurrently with other people making writes to the database, but comes at the cost that there is no longer any objective count of the rows in a given table: the number of rows is related to which transactions are considered live at any given moment.

http://wiki.postgresql.org/wiki/Slow_Counting

Re:Amazon Redshift - What You Need To Know by kungfooey on Sunday September 29, 2013 @09:27PM (#6467318)
In my case, this was inadvertently a good comparison. Most of the "ad-hoc" queries we're doing are AVG, SUM, or similar operations that require scanning the entire table.

I may try to edit this post to compare those operations, as it may be more meaningful.

Thanks for posting the link. TIL.

Re:Amazon Redshift - What You Need To Know by scragg on Sunday September 29, 2013 @07:57PM (#6467085)
I thought this query was instant in most dbs because it reads an internal row count of the table since this particular query has no conditions or joins.
Re:Amazon Redshift - What You Need To Know by sargun on Sunday September 29, 2013 @06:32PM (#6466811)
Does H2 do MVCC?
Re:Amazon Redshift - What You Need To Know by ogrisel on Monday September 30, 2013 @03:36AM (#6468258)
AFAIK not by default. Furthermore the MVCC mode is still considered experimental: http://www.h2database.com/html/advanced.html#mvcc