hubert depesz lubaczewski <depesz(at)depesz(dot)com> 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