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

Create index to find non empty titles for assignments #6580

Merged
merged 1 commit into from
Aug 21, 2024
Merged

Conversation

marcospri
Copy link
Member

@marcospri marcospri commented Aug 21, 2024

For:

A big time of the query time of get_assignments is spent finding assignments with not null titles.

Create an index on that condition trying to speed it up.

From the query plan:

Parallel Index Scan using ix__assignment_title on assignment  (cost=1833.94..114225.07 rows=74535 width=582) (actual time=5.866..60.334 rows=140 loops=3)
                          Index Cond: (title IS NOT NULL)

That 60ms out of a total of 80.

How much the query will improve will depend on the table stats, around 30 percent of the assignments have empty titles (imported from another table when we first created the assignment table), more info in https://stackoverflow.com/a/31966616

@marcospri marcospri changed the title Create index to find non empty titles for assigments Create index to find non empty titles for assignments Aug 21, 2024
A big time of the query time of get_assignments is spent finding
assignments with not null titles.

Create an index on that condition trying to speed it up.
@marcospri marcospri merged commit 4188890 into main Aug 21, 2024
9 checks passed
@marcospri marcospri deleted the not-null-title branch August 21, 2024 13:58
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 this pull request may close these issues.

2 participants