3 ms·
I guess you never tried to find optimal join orders for you sql engine.
by adrianN 3y ago
I guess you never tried to find optimal join orders for you sql engine.
- withinboredom 3y agoI actually have :), it was a time travelling database for $work. In our case, we assumed that queries wouldn't change too much (applications running on them tend to query the same tables over and over again). Thus we just picked an order "at random" (though IIRC, there were some heuristics) for table-sets, otherwise we used the best performing one seen so far -- but it would randomly run another query with a different order to keep finding the best one. We just didn't care about trying to solve it 'up-front' and were more interested in empirically choosing the best solution.
- adrianN 3y agoA random search like that might give okay results but has no guarantees approximation ratio.