- Feature Articles
- CodeSOD
- Error'd
-
Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I'm not sure the statement "But the query definitely should have returned results." is correct when the sql query contains a syntax error...
Edit Admin
I understood it as meaning "the intended query"...
Admin
Result of SQL query could be also an error. You want it returned instead of hiding it quitely.
Edit Admin
The database can alert you to queries that take a long time to execute, but it doesn't know how much time is spent in the network in between the application and database, so the database's number is less helpful when trying to figure out why some specific request to the app took a long time to return results. Having both numbers is ideal, since they're good for different things.
Edit Admin
The log warning is specifically about a "long query". I don't think whoever wrote that even considered such details as network latency.
The entire function smells of lazy convenience wrapper anyway.
Why bother handling errors? Too much repeated work. Let's just not surface them.
"That one time I needed to debug a long query" so let's just bake it into the wrapper forever.
Why bother have 2 functions when one vs multi results can be combined. It's DRY! No but whatever -- I've had seniority code reviewers forcing me to "merge and factorize" functions like that.
It's a helper method, right?
Admin
I like that a query taking over 0.4 seconds is classed as 'long'. They need to come speak with our SQL developers, they've got queries that run for upwards for 30 minutes!