刚发现个有趣的地方,pg可以给同一表的相同列创建相同索引N次!太疯狂了!
postgres=# create table testind(id int);
CREATE TABLE
postgres=# create index on testind (id);
CREATE INDEX
postgres=# create index on testind (id);
CREATE INDEX
postgres=# create index on testind (id);
CREATE INDEX
postgres=# create index on testind (id);
CREATE INDEX
postgres=# \d+ testind
Table "public.testind"
Column | Type | Modifiers | Storage | Stats target | Description
--------+---------+-----------+---------+--------------+-------------
id | integer | | plain | |
Indexes:
"testind_id_idx" btree (id)
"testind_id_idx1" btree (id)
"testind_id_idx2" btree (id)
"testind_id_idx3" btree (id)
postgres=#
那么以后创建索引的时候,要注意不要重复执行了。
PG索引创建与Oracle的不同
最新推荐文章于 2024-07-31 09:19:19 发布