在postgres上创建表达式索引



简单表

create table x(t timestamp);

在很多地方我需要说

where extract(year from t) and extract(quarter from t)

可以在这里声明一个表达式索引吗?和

可以使用下面的SQL:

create index idx_cust_test on x(extract(year from t), extract(quarter from t));

整个脚本可以被检查:小提琴

最新更新