3 ms·
I know of at least one commercial DBMS that will perform this transformation automatically in some circumstances, and I’d be surprised if most of the other majo
by twoodfin 6y ago
I know of at least one commercial DBMS that will perform this transformation automatically in some circumstances, and I’d be surprised if most of the other major systems couldn’t do the same.
- tpetry 6y agoAll database systems could implement many more optimizations. Heck, all these tricks to get the queries to complete faster are only needed because the database engine did not find this fast execution plan. The problem is the more optimizations you implement the more possibilities the query planner has to evalue which may result in (1) a too long query planning phase or (2) the possibility of de-optimizing a good query because an optimization was falsely predicted to be faster
- posedge 6y agoClever optimization engines are IMO no excuse for blindly throwing queries at it and not knowing what's going on. Every optimizer has some corner cases in which it fails and I'd argue that as a good developer you should know when they can happen. Additionally, in this example, the rewritten query is easier to read and maintain.