Yang Zhang <yanghatespam@xxxxxxxxx> writes: >> # select count(1) from (SELECT * from metarelcould_transactionlog >> order by transactionid) as foo; > Does it strike anyone else that the query optimizer/rewriter should be > able to toss out the sort from such a query altogether? It could, if it knew that the aggregate function didn't care about input row order. We don't have that knowledge about aggregates ATM. regards, tom lane -- Sent via pgsql-general mailing list (pgsql-general@xxxxxxxxxxxxxx) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general