技术开发 频道

行式数据库PostgreSQL 9.04版本评测

-bash-3.2$ cd /opt/postgres/9.0/bin
-bash-3.2$ date;./psql -d pgdb -f /user1/postgresql/data/q_a.sql -o /user1/postgresql/data/q_a.log;date
2011年 06月 16日 星期四
06:37:25 CST
Timing
is on.
Time:
381708.096 ms
Time:
13593.186 ms
Time:
51092.852 ms
Time:
11243.724 ms
Time:
60982.194 ms
Time:
25267.713 ms
Time:
46285.189 ms
Time:
13351.568 ms
Time:
197846.585 ms
Time:
49444.851 ms
Time:
6856.866 ms
Time:
36848.254 ms
Time:
48407.148 ms
Time:
25035.739 ms
Time:
4.456 ms
Time:
53304.458 ms
Time:
1.491 ms
Time:
18002.088 ms
Time:
3930.280 ms
Time:
97068.386 ms
Time:
37516.387 ms
Time:
7486.682 ms
Time:
143849.900 ms
Time:
5600.030 ms
2011年 06月 16日 星期四
06:59:40 CST

   从上述日志中可以看出,添加索引后,PostgreSQL对tpch的22个查询大约在22分钟可以完成,没有需要特别长时间才能完成的测试,最长的第一个查询也不过6分钟多。

  下面是各组查询测试结果,取实际运行时间。

3.测试数据和查询语句的产生步骤
▲表1 TPC-H scale=10各种压缩和索引数据的测试对比,单位:毫秒

  从表1可知,如果没有索引,大部分查询都能正常执行,加上索引后,大部分查询的用时差别不大,但字体加粗的查询则有明显的提高,基本上没有查询时间恶化的情况。这说明PostgreSQL的查询优化器还是比较强大的,从下一节执行计划的输出中可以看出,它采用基于成本的优化器技术,并且用到了hash join等高效的方法。

0