Post
Topic
Board Meta
Re: Quoting from locked threads (SMF patch)
by
PowerGlove
on 15/06/2024, 10:05:02 UTC
I am not 100% certain, but this may be an unnecessary query to the database. When quoting from a locked thread, the limit is set to zero, so no rows will be returned in the query, but the query will still run.
Yup, the query will run, but the intention there is for the query optimizer to recognize the LIMIT 0 and internally reduce that query down to something that quickly returns an empty set (look for "LIMIT Query Optimization" in the MySQL documentation).

In general, when you spot an odd-looking construct in one of my SMF patches, it's likely because I estimated that the alternative way(s) of doing that thing would have led to a less compact diff. Obviously, I'm not going to favor small diffs over every other concern, but it is something that heavily factors into my decision-making (because, in turn, I believe it's something that factors into theymos' decision-making).