postgres 中的索引元组最大大小是多少?
What is the index tuple maximum size in postgres?
关于 INCLUDE
条款,我引用了 https://www.postgresql.org/docs/11/sql-createindex.html:
It's wise to be conservative about adding non-key columns to an index, especially wide columns. If an index tuple exceeds the maximum size allowed for the index type, data insertion will fail. In any case, non-key columns duplicate data from the index's table and bloat the size of the index, thus potentially slowing searches.
我想知道这是什么 index tuple max size
可能会导致插入失败的 btree 索引。
用例:我正在考虑 INCLUDE
将 json 列(<1000 个字符)添加到唯一索引。
它是块大小的函数,对于 btree 索引略小于块大小的 1/3。对于默认的 8kB 块大小,最大为 2704 字节:
insert into foo select string_agg(x::text,'') from generate_series(1,940) f(x);
ERROR: index row size 2728 exceeds btree version 4 maximum 2704 for index "foo_pkey"
关于 INCLUDE
条款,我引用了 https://www.postgresql.org/docs/11/sql-createindex.html:
It's wise to be conservative about adding non-key columns to an index, especially wide columns. If an index tuple exceeds the maximum size allowed for the index type, data insertion will fail. In any case, non-key columns duplicate data from the index's table and bloat the size of the index, thus potentially slowing searches.
我想知道这是什么 index tuple max size
可能会导致插入失败的 btree 索引。
用例:我正在考虑 INCLUDE
将 json 列(<1000 个字符)添加到唯一索引。
它是块大小的函数,对于 btree 索引略小于块大小的 1/3。对于默认的 8kB 块大小,最大为 2704 字节:
insert into foo select string_agg(x::text,'') from generate_series(1,940) f(x);
ERROR: index row size 2728 exceeds btree version 4 maximum 2704 for index "foo_pkey"