2021
01-21
01-21
PostgreSQL利用递归优化求稀疏列唯一值的方法
在数据库中经常会碰到一些表的列是稀疏列,只有很少的值,例如性别字段,一般就只有2种不同的值。但是当我们求这些稀疏列的唯一值时,如果表的数据量很大,速度还是会很慢。例如:创建测试表bill=#createtablet_sex(sexchar(1),otherinfotext);CREATETABLEbill=#insertintot_sexselect'm',generate_series(1,10000000)||'thisistest';INSERT010000000bill=#insertintot_sexselect'w',generate_series(1,10...
继续阅读 >