hubert depesz lubaczewski <depesz@xxxxxxxxxx> writes: > and we have a query: > select count(*) from objects where state='active'::text and ending_tsz <= ( select now() - '1 day'::interval ); Try getting rid of the sub-select. There might have been a reason to do it like that ten years ago, but these days it's a guaranteed pessimization. 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