Comments (6)
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.
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.
@fatalmind Released in v0.1.2, thank you :)
from order_query.
@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.
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.
@fatalmind Thank you, order_query is now free of bugs that prevent index usage 🎱
from order_query.
Related Issues (20)
- Ordering by NULLS FIRST / LAST HOT 10
- documentation on how to "paginate" results HOT 6
- new version release HOT 1
- Test on multiple databases
- is sorting by an associated column supported? HOT 10
- pass table and column to custom sql function HOT 11
- Nulls ordering skips records if there is more than one NULL HOT 6
- TODO: Better tests for nils in enums
- Change base scope? HOT 2
- Get point for reverse scope HOT 2
- Rails 6 support HOT 2
- Wrong order? HOT 1
- Calling prev and next when the ordering model attribute is enumerable creates an invalid SQL where clause HOT 2
- Support of Rails 7.1 HOT 3
- Redundant condition elimination
- #seek or #at with previously specified order HOT 5
- Can this sort on nested attributes? HOT 3
- Feature Request: HOT 1
- .previous always showing first record when limiting scope HOT 2
- Not compatible with rails 5 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from order_query.