PostgreSQL:select null vs false的性能 [英] PostgreSQL: performance of select null vs false
本文介绍了PostgreSQL:select null vs false的性能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在具有大表(> 1000万行)的PostgreSQL(v9.4)中,这两个查询的性能(速度)是否有差异?
In PostgreSQL (v9.4) with a big table (> 10M rows), is there any difference in the performance (speed) of these two queries?
- 在
bigint
列中选择所有值为null
的条目。 - 在
boolean
列中选择所有值为false
的条目。
- Select all entries with a
null
value in abigint
column. - Select all entries with a
false
value in aboolean
column.
此外,如果对 varchar
列执行查询编号1,会有所不同吗?
Also, would it make any difference if query number 1 was performed on a varchar
column?
谢谢!
推荐答案
否-从理论上讲,您在并会产生性能差异。您只是在比较数据。区别在于您在WHERE子句中指定的任何列是否已建立索引。
No--theoretically, none of your options in and of themselves will produce a performance difference. You are merely comparing data. Where there will be a difference is if any of the columns you specify in your WHERE clause is indexed.
这篇关于PostgreSQL:select null vs false的性能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文