SharonIV0x86 commented on PR #2832: URL: https://github.com/apache/kvrocks/pull/2832#issuecomment-2729845808
Hey @AryanVBW , this PR looks like a good starting point, but it’s missing a some of the key parts to be a functional KQIR optimizer. There’s no actual equality saturation algorithm, the rewrite rules don’t do anything yet, the cost model is just a placeholder, and it’s not integrated with Kvrocks' query engine (this can be done later ig). Plus, without tests or benchmarks, we can’t validate if it actually improves anything. I’d suggest making this a draft PR and continuing work on it, or creating a separate branch where we can properly develop it before merging. To the best of my knowledge, this is going to be much more complex than standard SQL parsing. I’d recommend checking out some existing articles like [KQIR: a query engine for Apache Kvrocks](https://kvrocks.apache.org/blog/kqir-query-engine/) to get better understanding of how query optimization works in Kvrocks. A good next step would be to experiment with combining multiple operations like ``SCAN``, ``ZRANGE``, and ``GET``. The optimizer can then use egraphs to explore different ways to merge or reorder these operations, in the end finding the most efficient execution path. A really good resource: https://egraphs-good.github.io/ Very interesting introduction to egraphs: https://www.cole-k.com/2023/07/24/e-graphs-primer/ -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
