-
Notifications
You must be signed in to change notification settings - Fork 872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question regarding date-range queries with composite index #6795
Comments
Hi @rdelangh did you try to do the query with LIMIT 1 and see how long it takes to return? I think the easiest thing to do is to create a small dataset with your data model and try an EXPLAIN on that to make sure that the query is using the index Thanks Luigi |
I have another class "mds_csv_cf12" with many fewer records. I run a However, if I run these queries select count(*) FROM INDEX:idx_mds_csv_cf12_0 WHERE key between '2016-06-22 00:00:00' AND '2016-06-22 23:00:00' or select count(*) FROM INDEX:idx_mds_csv_cf12_0 WHERE key between ['2016-06-22 00:00:00'] AND ['2016-06-22 23:00:00'] the result comes back in a split second but is each time 0 (zero), however there is definately such records in the class... The "explain select ..." statement shows me no info at all about using index : { |
@luigidellaquila , @lvca If I change the criteria with strings such as '2016-06-22 00:00:00.000' (that is including the milliseconds part), then the index is used, and the query runs very fast... -> can this be enhanced in the parser, that it recognizes DATETIME values better from partial strings like '2016-06-22 00:00:00' or even '2016-06-22' ? |
Hi @rdelangh Thanks, good catch! Thanks Luigi |
@luigidellaquila |
1 similar comment
@luigidellaquila |
hello ODB gurus, is here any update possible please? |
Hi @rdelangh So sorry, let me check it now... Luigi |
Hi @rdelangh I just tried it on latest 2.2.17 and it seems to correctly use the index... maybe it's already fixed? Thanks Luigi |
Hi @rdelangh I'm closing this, it should be solved long time ago. Please feel free to re-open if you see any related problems Thanks Luigi |
OrientDB Version, operating system, or hardware.
Operating System
I have a class 'myclass' with many properties, among which a DATETIME property named 'start_date'. I made a UNIQUE index
CREATE INDEX myindex ON myclass(start_date, filename, recordnumber) UNIQUE
If I want to search on a range of 'start_date' and a particular filename value. I would expect that the following query returns results in a reasonable timeframe:
SELECT max(someotherproperty) FROM myclass WHERE start_date BETWEEN '2016-10-07 10:00:00' AND '2016-10-07 12:00:00' AND filename = 'foobar'
However after 3 hours of waiting still no result returned, the query is still busy... There is approx 5M records per day in this class, and about 600M records in the entire class. So I suspect strongly that this query is doing a full scan of the class, not using the index.
I read the documentation on indexes and composite indexes, range queries etc. But cannot figure out what's happening (or not) with the above query. Asking an explain plan is of no use, I have the impression that this explain plan is determined from how the query has ran, after it did ran completely. Which takes hours (or more) to complete...
The text was updated successfully, but these errors were encountered: