Code Monkey home page Code Monkey logo

Comments (6)

glebm avatar glebm commented on May 28, 2024

Note that Oracle seems to be doing something else here: it plans a union for each top-level OR clause. Not sure if it does anything beyond this in our case. https://blogs.oracle.com/optimizer/entry/or_expansion_transformation

from order_query.

fatalmind avatar fatalmind commented on May 28, 2024

Yes, it may do that. Or not, that really depends on many factors. For the general case, in my experience, it is better to go for the "read too much" solution as shown in my article. Row-Values would be best of course, but that's only properly handled by PostgreSQL.

from order_query.

glebm avatar glebm commented on May 28, 2024

@fatalmind Released in v0.1.2, thank you :)

from order_query.

glebm avatar glebm commented on May 28, 2024

@fatalmind I wonder if the extra condition helps for enumerated order values, e.g.:

SELECT "issues".* FROM "issues"  WHERE 
  ("issues"."pinned" IN ('t','f') AND 
    ("issues"."pinned" = 't' OR
    "issues"."pinned" = 'f' AND ("issues"."priority" = 'high' ... 

from order_query.

fatalmind avatar fatalmind commented on May 28, 2024

No, because IN-Lists are disjunct conditions by themselves.

In that case I'd recommend just going for the simple way.

Generally: you need to have a so-called SARGable (search-argument-able) condition at the top-level. These are basically equals (=), ranges (>, <, but potentially also LIKEs without prefix-wildcard).

from order_query.

glebm avatar glebm commented on May 28, 2024

@fatalmind Thank you, order_query is now free of bugs that prevent index usage 🎱

from order_query.

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.