Skip to content
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

Add an index in table resource_view to improve DB performance #7134

Closed
FuhuXia opened this issue Oct 11, 2022 · 0 comments · Fixed by #7135
Closed

Add an index in table resource_view to improve DB performance #7134

FuhuXia opened this issue Oct 11, 2022 · 0 comments · Fixed by #7135
Assignees

Comments

@FuhuXia
Copy link
Contributor

FuhuXia commented Oct 11, 2022

CKAN version
2.9.6, master

Describe the bug
Table resource_view needs a index on column resource_id.

Steps to reproduce
In a big CKAN database (500k packages) run the query

begin;
explain (analyze,buffers,timing)
delete from resource where package_id = [###];                                  
rollback;
...
Trigger for constraint resource_view_resource_id_fkey: time=68.124 calls=6

Expected behavior

CREATE INDEX idx_view_resource_id
ON resource_view(resource_id);

After the index added, the time dropped from 68.124 to 0.420, that is 170 times faster.

Additional details
This will greatly reduce time spent when clearing a big harvest source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants