Does primary key not equal zero id != 0
in where
clause reduce query performance? Does this checking prevent taking the advantage of index
ing?
可以将文章内容翻译成中文,广告屏蔽插件会导致该功能失效:
问题:
回答1:
Does primary key not equal zero id != 0 in where clause reduce query performance?
It does in the way that you end up with a full table scan.
Does this checking prevent taking the advantage of indexing?
Yes. Since id != 0
will almost always evaluate to true you end up retrieving all of the table data, thus not taking advantage of your index at all.