時間:2024-02-05 12:47作者:下載吧人氣:30
在數(shù)據(jù)庫中經(jīng)常會碰到一些表的列是稀疏列,只有很少的值,例如性別字段,一般就只有2種不同的值。
但是當(dāng)我們求這些稀疏列的唯一值時,如果表的數(shù)據(jù)量很大,速度還是會很慢。
例如:
創(chuàng)建測試表
bill=# create table t_sex (sex char(1), otherinfo text);
CREATE TABLE
bill=# insert into t_sex select ‘m’, generate_series(1,10000000)||’this is test’;
INSERT 0 10000000
bill=# insert into t_sex select ‘w’, generate_series(1,10000000)||’this is test’;
INSERT 0 10000000
網(wǎng)友評論