PostgreSQL Datetrunc demasiado lento
CREATE INDEX ON test (date_trunc('day', updated_at));
/*If updated_at is a timestamp without time zone, that will work fine.
For a timestamp with time zone, you'll have to specify a time zone,
because otherwise the result will depend on the session time zone,
which makes it unusable for an index:*/
CREATE INDEX ON test (date_trunc('day', updated_at AT TIME ZONE 'UTC'));
GutoTrosla