Giter Club home page Giter Club logo

Comments (4)

andyfengHKU avatar andyfengHKU commented on September 25, 2024

Hi Ervin,

We did implement a similar feature when we perform benchmark internally. The query interface under Connection can take encodedJoin as a parameter which will guide the join order.

std::unique_ptr<QueryResult> Connection::query(
    const std::string& query, const std::string& encodedJoin) {
    lock_t lck{mtx};
    auto preparedStatement = prepareNoLock(query, true /* enumerate all plans */, encodedJoin);

One example of encoded is join can be found under benchmark/queries/ldbc-sf100/join

-NAME q29
-COMPARE_RESULT 1
-QUERY MATCH (a:Person)-[:knows]->(b:Person) RETURN MIN(a.birthday), MIN(b.birthday)
-ENCODED_JOIN HJ(b._ID){E(b)S(a)}{S(b)}
---- 1
1980-02-01|1980-02-01

S stands for SCAN, E stands for EXTEND and HJ stands for HJ. Inside HJ() is the join condition, i.e. the _ID of the table that we are joining on.

Note that it may not always be able to find the join order if the join graph becomes very large. This feature is not very user friendly but might be able to solve your problem temporarily.

In the long term, I will expose a configuration to disable join order optimizer, and the join order will be picked in the left to right order as the written query.

from kuzu.

ErvinXie avatar ErvinXie commented on September 25, 2024

Hello Andy, thanks for your detailed reply.

Besides the join order, I wonder if I can control the physical plan? Such as use worst case optimal join instead of binary hash join, and change aggregation orders. I know usually there is no user interface for this kind of demand. So which part of code should I edit if I want to build a execution plan on my own and execute it?

from kuzu.

andyfengHKU avatar andyfengHKU commented on September 25, 2024

I think for worst case optimal join you can still encode, e.g.

Given statement

(a)->(b)->(c), (a)->(c)

One WCOJ plan could be encoded as

I(c._id){E(b)S(a)}{E(c)S(a)}{E(c)S(b)}

For aggregation order, I'm assuming you mean eager/lazy aggregation. I think the most principled way is to write an optimizer rule to do that. Which means you will need to take a look at optimizer module and add your own ones. Alternatively this could be done during planning phase so you can change planner module. Let me know if my understanding of aggregation order is wrong. Happy to chat more in slack if you want.

from kuzu.

ErvinXie avatar ErvinXie commented on September 25, 2024

Thank you for the reply. I will look into the code then.

from kuzu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.