📅  最后修改于: 2022-03-11 15:04:58.350000             🧑  作者: Mango
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'));