Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
S slapos.core
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Labels
    • Labels
  • Merge requests 28
    • Merge requests 28
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Members
    • Members
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • nexedi
  • slapos.core
  • Merge requests
  • !201

Merged
Created Apr 13, 2020 by Jérome Perrin@jeromeOwner

collect: small optimization on garbage collect

  • Overview 1
  • Commits 1
  • Pipelines 1
  • Changes 1

This changes a query like:

SELECT date FROM user WHERE reported = 1 AND date != '2020-04-13' AND date != '2020-04-12'  AND date != '2020-04-11'  AND date != '2020-04-10'  AND date != '2020-04-09'  AND date != '2020-04-08'  AND date != '2020-04-07'  AND date != '2020-04-06'  AND date != '2020-04-05' AND date != '2020-04-04'  AND date != '2020-04-03'  AND date != '2020-04-02'  AND date != '2020-04-01'  AND date != '2020-03-31'  AND date != '2020-03-30'  LIMIT 1

EXPLAIN QUERY PLAN ...
0|0|0|SCAN TABLE user USING COVERING INDEX user_date_reported_index

which took ~3 seconds on a 1.5Go collector.db into:

SELECT date FROM user WHERE reported = 1 AND (date < '2020-03-30'  OR  date > '2020-04-13')  LIMIT 1

EXPLAIN QUERY PLAN ...
0|0|0|SEARCH TABLE user USING COVERING INDEX user_date_reported_index (date<?)
0|0|0|SEARCH TABLE user USING COVERING INDEX user_date_reported_index (date>?)

which is instant.

Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: feat/collect_garbage_collect_faster_query
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7