I think probably a combination of 2 and 3 would be best. I'm not sure exactly where it takes place but there is certainly ways to hint to the optimizer on what physical operators should be used. Sometimes it has an effect on the plan structure later on though. For example our index hints, which were introduced in zhttps://asterix-gerrit.ics.uci.edu/c/asterixdb/+/9124 and improved in https://asterix-gerrit.ics.uci.edu/c/asterixdb/+/18177 . To make the two plans you could have a configuration variable passed through a SET statement, similar to how cost based optimization is turned on or off globally, and just toggle it.
Others with deeper knowledge of how CBO passes it's choices regarding indexes and join ordering down to the rest of the optimizer might also have some good hints. It's certainly an interesting idea, and it would be even cooler if we could do it dynamically somehow. On Jan 16, 2025 at 15:36:44, Pratyoy Das <praty...@uci.edu> wrote: > Hi all, > In my current research project, I am interested in studying and creating > query plans that prioritize latency of individual answers rather than the > throughput of the overall query in order to promote progressive query > answering. For that, we want to create a new plan, an "interactive" plan to > supplement the original blocking plan that the planner creates. > An example usage of interactive plan might be the use of an index > to expedite the processing of a group of values that will be useful earlier > to the user. > I am trying to implement this on top of Asterix DB and I am currently in > the process of finalizing my design. One thing that I am debating with is, > where do I put the logic of rewriting the blocking plan into the > interactive plan? Several options come to mind:- > 1. Doing it after the final physical plan has been generated by the > planner. > 2. Doing it at the beginning, where a compiler compiles two plans - one for > the interactive method and the other for the blocking method. > 3. Doing it in the middle, where some logical rewrites have taken place, > but the physical operators haven't been finalized yet. > > Any opinions/thoughts about the matter are highly welcome! Happy to provide > more details if necessary. > > -- > Best Regards, > Pratyoy >