I am having a ~90 MB SQLite database on a SSD consisting mostly on message attachments including a BLOB column content, that stores the binary attachment data.
Now I found that the following query
SELECT message_id FROM attachments WHERE length(content) IS NULL;
is 500x faster (0.5ms vs. 250ms) than the original
SELECT message_id FROM attachments WHERE content IS NULL;
Is it true, that both queries are equivalent?
Additional info
- No indexes are involved apart from the autoindex.
- It's not caching. The result can be reproducued unlimited times in any order from any number of SQLite processes.
length(NULL)
is not 0 but NULL, thus the previous question was not a performance issue but I was not able to read the manual correctly.