Skip to content

[14.0] queue_job: fix partial index to add wait_dependencies state - #629

Merged
OCA-git-bot merged 1 commit into
OCA:14.0from
camptocamp:14-queue_job-fix-partial-index
Mar 6, 2024
Merged

[14.0] queue_job: fix partial index to add wait_dependencies state#629
OCA-git-bot merged 1 commit into
OCA:14.0from
camptocamp:14-queue_job-fix-partial-index

Conversation

@sebalix

@sebalixsebalix commented Mar 6, 2024

Copy link
Copy Markdown
Contributor

Some details about the search performed by the method job_record_with_same_identity_key in file queue_job/job.py, the partial index wasn't used before:

Before

Limit (cost=6874.52..6874.53 rows=1 width=20) (actual time=0.123..0.123 rows=0 loops=1)
-> Sort (cost=6874.52..6874.53 rows=1 width=20) (actual time=0.121..0.121 rows=0 loops=1)
Sort Key: date_created DESC, date_done DESC
Sort Method: quicksort Memory: 25kB
-> Index Scan using queue_job_state_index on queue_job (cost=0.42..6874.51 rows=1 width=20) (actual time=0.113..0.113 rows=0 loops=1)
Index Cond: ((state)::text= ANY ('{wait_dependencies,pending,enqueued}'::text[]))
Filter: ((identity_key)::text='f75c2b628243d651bad356030a3021a95dbe7725'::text)
Planning Time: 0.375 ms
Execution Time: 0.161 ms

After

Limit (cost=8.15..8.16 rows=1 width=20) (actual time=0.032..0.032 rows=0 loops=1)
-> Sort (cost=8.15..8.16 rows=1 width=20) (actual time=0.030..0.030 rows=0 loops=1)
Sort Key: date_created DESC, date_done DESC
Sort Method: quicksort Memory: 25kB
-> Index Scan using queue_job_identity_key_state_partial_index on queue_job (cost=0.12..8.14 rows=1 width=20) (actual time=0.019..0.019 rows=0 loops=1)
Index Cond: ((identity_key)::text='f75c2b628243d651bad356030a3021a95dbe7725'::text)
Planning Time: 0.844 ms
Execution Time: 0.094 ms

@OCA-git-bot

Copy link
Copy Markdown
Contributor

Hi @guewen,
some modules you are maintaining are being modified, check this out!

@sebalix
sebalix marked this pull request as ready for review March 6, 2024 11:09
@sebalix
sebalixforce-pushed the 14-queue_job-fix-partial-index branch 2 times, most recently from 6a47170 to ba9f49cCompareMarch 6, 2024 11:22
@sebalix

Copy link
Copy Markdown
ContributorAuthor

Added a pre-migration script to drop the index to get it re-created automatically during the module update.

@sebalix
sebalixforce-pushed the 14-queue_job-fix-partial-index branch from ba9f49c to fe4fe95CompareMarch 6, 2024 11:25
@simahawk

Copy link
Copy Markdown
Contributor

/ocabot merge patch

@sebalix could you fwd port it pls?

@OCA-git-bot

Copy link
Copy Markdown
Contributor

This PR looks fantastic, let's merge it!
Prepared branch 14.0-ocabot-merge-pr-629-by-simahawk-bump-patch, awaiting test results.

@OCA-git-bot

Copy link
Copy Markdown
Contributor

Congratulations, your PR was merged at 4c824c2. Thanks a lot for contributing to OCA. ❤️

@sebalix
sebalix deleted the 14-queue_job-fix-partial-index branch March 6, 2024 12:29
@sebalix

sebalix commented Mar 6, 2024

Copy link
Copy Markdown
ContributorAuthor

@simahawk@guewen ported missing commits:

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants

@sebalix@OCA-git-bot@simahawk@guewen