Re:SQL Anti-Patterns You Should Avoid
by EvanAnderson on Saturday October 18, 2025 @03:40PM
(#45629878)
That seems like your RDBMS wasn't handling something right there or there wasn't a unique index on the column.
Do you recall what the database server was?
Re:SQL Anti-Patterns You Should Avoid
by dotancohen on Saturday October 18, 2025 @05:17PM
(#45630410)
Yes, I was using Mysql exclusively at the time. I don't recall which version.
I also tested this once years later when doing a Python app with sqlite. Similar result, but admittedly that was not a very big table to begin with.
I am meticulous with my database schemas, and periodically review my indexes and covering indexes. I'm no DBA, but I believe that the database is the only real value a codebase has, other than maybe a novel method here and there. So I put care into designing it properly and testing my assumptions.
Re:SQL Anti-Patterns You Should Avoid
by buckle8017 on Saturday October 18, 2025 @03:22PM
(#45629744)
You are certainly doing something wrong if that's true.
I'm curious, can you demo this?
Re:SQL Anti-Patterns You Should Avoid
by dotancohen on Saturday October 18, 2025 @05:21PM
(#45630442)
I'm curious as well to see if this still holds up. I'll try this week.
That would be a reportable bug. Of a pretty high priority.
Re:SQL Anti-Patterns You Should Avoid
by Guillaume86 on Sunday October 19, 2025 @11:20AM
(#45634828)
You should use the DB explain or equivalent command to spit out the query plan, limit 1 shouldn't change anything in your case, if it's not the case you should file an issue, it's pretty much 101 of query optimization.
I'll test again, really the last time I tested that was two decades ago.