Title: Make "between" query conditions use index data · Issue #1186 · objectbox/objectbox-java · GitHub
Open Graph Title: Make "between" query conditions use index data · Issue #1186 · objectbox/objectbox-java
X Title: Make "between" query conditions use index data · Issue #1186 · objectbox/objectbox-java
Description: Build info ObjectBox version: 3.5.0 OS: Android 14 Device/ABI/architecture: Pixel 8 Pro Steps to reproduce I have a database that contains say 100,000 rows. I try to query 20,000 rows using an id + a between query on an indexed long. It ...
Open Graph Description: Build info ObjectBox version: 3.5.0 OS: Android 14 Device/ABI/architecture: Pixel 8 Pro Steps to reproduce I have a database that contains say 100,000 rows. I try to query 20,000 rows using an id +...
X Description: Build info ObjectBox version: 3.5.0 OS: Android 14 Device/ABI/architecture: Pixel 8 Pro Steps to reproduce I have a database that contains say 100,000 rows. I try to query 20,000 rows using an id +...
Opengraph URL: https://github.com/objectbox/objectbox-java/issues/1186
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Make \"between\" query conditions use index data","articleBody":"### Build info\r\n\r\n- ObjectBox version: 3.5.0\r\n- OS: Android 14\r\n- Device/ABI/architecture: Pixel 8 Pro\r\n\r\n### Steps to reproduce\r\n\r\nI have a database that contains say 100,000 rows. I try to query 20,000 rows using an id + a between query on an indexed long. It takes ~1.5 seconds in average, sometime up to 5-10s.\r\n\r\nData is frequently written to the database, about 40 times per second. Is that an issue? About 2400 rows are added per second in total between these writes.\r\n\r\nThe relativeSamplingTimestamp that is used as index has 2 values for the same timestamp in all cases (2 different data streams with same time). Like:\r\n\r\n1\r\n1\r\n2\r\n2\r\n3\r\n3\r\n...\r\n\r\n### Expected behavior\r\n\r\nI would expect it to be under a 100ms?\r\n\r\n### Actual behavior\r\n\r\nTakes 1-10 seconds. Average 1.5s.\r\n\r\n\r\n### Code\r\n\r\n\u003cdetails\u003e\u003csummary\u003eCode\u003c/summary\u003e\r\n\r\n```java\r\nSchema:\r\n\r\n @Id\r\n public long id\r\n public ToOne\u003cLocalSession\u003e localSession;\r\n @Convert(converter = Converters.SerializableConverter.class, dbType = byte[].class)\r\n private HashMap\u003cInteger, Float\u003e samples;\r\n @Convert(converter = Converters.InstantConverter.class, dbType = Long.class)\r\n private Instant receptionTimestamp;\r\n @Nullable\r\n @Index\r\n private Integer relativeSamplingTimestamp;\r\n @Convert(converter = Converters.InstantConverter.class, dbType = Long.class)\r\n @Index\r\n @Nullable\r\n private Instant absoluteSamplingTimestamp;\r\n\r\nQuery:\r\n samplesRelativeTimestampBetweenQuery = sampleBox.query().equal(Sample_.localSessionId, 0)\r\n .between(Sample_.relativeSamplingTimestamp, 0, 0).build();\r\n\r\nWhich i then call with parameters like:\r\n\r\nsamplesRelativeTimestampBetweenQuery.setParameter(\r\n Sample_.localSessionId, localSessionId)\r\n .setParameters(Sample_.relativeSamplingTimestamp, startTimestamp, endTimestamp)\r\n .find())\r\n```\r\n\r\n\u003c/details\u003e\r\n","author":{"url":"https://github.com/eric-nextsense","@type":"Person","name":"eric-nextsense"},"datePublished":"2024-08-23T06:59:28.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":4},"url":"https://github.com/1186/objectbox-java/issues/1186"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:d272c60b-c6ef-1183-5d3a-7a3bf07cef27 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | DDF0:5E790:1FF8B74:28FB01E:697FCA0F |
| html-safe-nonce | ff643fb53ee7647b0faf53ce0bba0dd26fb34b8c3e90932186f316ca31e9b52e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEREYwOjVFNzkwOjFGRjhCNzQ6MjhGQjAxRTo2OTdGQ0EwRiIsInZpc2l0b3JfaWQiOiI0MzYxMTUyODg5ODMwMjMwNTQzIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 65114e5e119be25c6585e34910d5305f099814c68e9885cdfaca86d437d30872 |
| hovercard-subject-tag | issue:2482456341 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/objectbox/objectbox-java/1186/issue_layout |
| twitter:image | https://opengraph.githubassets.com/30033ce4194566a68c8fdb12f713600b66cadb1ca52c5b4cb7b219899a31fcdf/objectbox/objectbox-java/issues/1186 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/30033ce4194566a68c8fdb12f713600b66cadb1ca52c5b4cb7b219899a31fcdf/objectbox/objectbox-java/issues/1186 |
| og:image:alt | Build info ObjectBox version: 3.5.0 OS: Android 14 Device/ABI/architecture: Pixel 8 Pro Steps to reproduce I have a database that contains say 100,000 rows. I try to query 20,000 rows using an id +... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | eric-nextsense |
| hostname | github.com |
| expected-hostname | github.com |
| None | 60279d4097367e16897439d16d6bbe4180663db828c666eeed2656988ffe59f6 |
| turbo-cache-control | no-preview |
| go-import | github.com/objectbox/objectbox-java git https://github.com/objectbox/objectbox-java.git |
| octolytics-dimension-user_id | 22327943 |
| octolytics-dimension-user_login | objectbox |
| octolytics-dimension-repository_id | 79901405 |
| octolytics-dimension-repository_nwo | objectbox/objectbox-java |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 79901405 |
| octolytics-dimension-repository_network_root_nwo | objectbox/objectbox-java |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7c85641c598ad130c74f7bcc27f58575cac69551 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width