Vertica table 中的列数是否会影响查询性能?

Does the number of columns in a Vertica table impact query performance?

我们正在使用包含 500 列和 100 000 行的 Vertica 8.1 table。

即使直接在其中一个 Vertica 集群节点上使用 vsql 客户端(以消除任何网络延迟问题),执行以下查询也需要大约 1.5 秒:

SELECT COUNT(*) FROM MY_TABLE WHERE COL_132 IS NOT NULL and COL_26 = 'anotherValue'

但是查看query_requeststable时,request_duration_ms只有98ms,resource_acquisitionstable没有任何延迟资源获取。想不明白剩下的时间都花在哪儿了

如果我然后导出到一个新的 table 只有查询使用的列,并且 运行 这个新的、更小的 table 上的查询,我得到一个极快的速度响应,即使 query_requests table 仍然告诉我 request_duration_ms 大约是 98 毫秒。

因此,table 中的列数似乎会影响查询的执行时间,即使这些列中的大部分未被引用。我错了吗 ?如果是,为什么会这样?

提前致谢

听起来您的查询 运行 针对的是包含所有表的(默认)超级投影。即使 Vertica 是一个列式数据库(具有相关的压缩和编码),您的查询可能仍然接触到比它需要的更多的数据。

您可以创建 projections to optimize your queries. A projection contains a subset of columns; if one is available that has all the columns your query needs, then the query uses that instead of the superprojection. (It's a little more complicated than that, because physical location is also a factor, but that's the basic idea.) You can use the Database Designer 以根据您的模式和示例查询创建一些初始预测,并随着时间的推移迭代改进它。

我是 运行 Vertica 8.1.0-1,看来问题是 Vertica 规划阶段的 Vertica 错误导致性能下降。它在版本 >= 8.1.1 中得到解决: [https://my.vertica.com/docs/ReleaseNotes/8.1.x/Vertica_8.1.x_Release_Notes.htm]

VER-53602 - Optimizer - This fix improves complex query performance during the query planning phase.