Database query questions are like this. It starts off with a "how do I make this query work properly" Followed by an answer, with a comment saying "this is not very efficient", then someone eventually compares two of three methods
"Method A) took 0.00031 seconds, but method B) took a whole 0.00125 seconds in a 30GB table test"
And you consider this a bad thing? This is what matters in real life. Method A is 4 times faster which is HUGE. Actually I find it awesome that someone makes the effort of measuring them for you.
It might be huge. It also might be completely negligible. I think our mentally disabled friend (check username) above was talking about an instance where the answering folks have no idea about the use-case and just deep dive into optimization. It might be a query that's called once in an application's entire life-cycle.
if this method is a performance critical code path, this miniscule level of savings will matter a lot - especially if used millions of times per day/hour
Yup, however the optimal query and hints will depend on the datashape, keys, and indicies of the table. Between those and the query plan generation, it can be tough to guess which one will be better.
9
u/RetardedWhiteMan Feb 06 '18
Database query questions are like this. It starts off with a "how do I make this query work properly" Followed by an answer, with a comment saying "this is not very efficient", then someone eventually compares two of three methods
"Method A) took 0.00031 seconds, but method B) took a whole 0.00125 seconds in a 30GB table test"