時(shí)間:2024-02-05 12:47作者:下載吧人氣:21
在數(shù)據(jù)庫(kù)中經(jīng)常會(huì)碰到一些表的列是稀疏列,只有很少的值,例如性別字段,一般就只有2種不同的值。
但是當(dāng)我們求這些稀疏列的唯一值時(shí),如果表的數(shù)據(jù)量很大,速度還是會(huì)很慢。
例如:
創(chuàng)建測(cè)試表
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)友評(píng)論