--以 t_credit_trans_tag 表为例
--查询索引
select * from pg_indexes where tablename='t_credit_trans_tag';
--创建索引
CREATE INDEX time_index ON pay_data.t_credit_trans_tag USING btree (create_time);
CREATE UNIQUE INDEX t_credit_trans_tag_pkey ON pay_data.t_credit_trans_tag USING btree (id);
--删除索引
drop index time_index;
注意:
虽然索引的目的在于提高数据库的性能,但这里有几个情况需要避免使用索引。
使用索引时,需要考虑下列准则:
1、索引不应该使用在较小的表上。
2、索引不应该使用在有频繁的大批量的更新或插入操作的表上。
3、索引不应该使用在含有大量的NULL值的列上。
4、索引不应该使用在频繁操作的列上。