Skip to content

notifier: delete manifest_index_manifest_id_package_id_dist_id_repo_id_idx#677

Merged
hdonnay merged 1 commit into
quay:mainfrom
crozzy:delete-manifest-index-index
Oct 20, 2022
Merged

notifier: delete manifest_index_manifest_id_package_id_dist_id_repo_id_idx#677
hdonnay merged 1 commit into
quay:mainfrom
crozzy:delete-manifest-index-index

Conversation

@crozzy
Copy link
Copy Markdown
Contributor

@crozzy crozzy commented Sep 23, 2022

Currently, we have two indexes (manifest_index_manifest_id_package_id_dist_id_repo_id_idx and manifest_index_unique) that cover the same data. As manifest_index_unique is chosen by the query planner to service affected manifest queries and keeps the unique constraint, and manifest_index_manifest_id_package_id_dist_id_repo_id_idx takes up a large amount of storage, it is surplus to requirements.

Signed-off-by: crozzy joseph.crosland@gmail.com

@crozzy crozzy requested a review from a team as a code owner September 23, 2022 18:35
@crozzy crozzy requested review from hdonnay and removed request for a team September 23, 2022 18:35
@crozzy
Copy link
Copy Markdown
Contributor Author

crozzy commented Sep 23, 2022

EXPLAIN SELECT
	manifest.hash
FROM
	manifest_index
	JOIN manifest ON
			manifest_index.manifest_id = manifest.id
WHERE
	package_id = 61
	AND (
			CASE
			WHEN 3::INT8 IS NULL THEN dist_id IS NULL
			ELSE dist_id = 3
			END
		)
	AND (
			CASE
			WHEN null::INT8 IS NULL THEN repo_id IS NULL
			ELSE repo_id = 2
			END
		);
Nested Loop  (cost=4.35..21.86 rows=1 width=32)
  ->  Bitmap Heap Scan on manifest_index  (cost=4.20..13.68 rows=1 width=8)
        Recheck Cond: (package_id = 61)
        Filter: ((repo_id IS NULL) AND (dist_id = 3))
        ->  Bitmap Index Scan on manifest_index_unique  (cost=0.00..4.20 rows=6 width=0)
              Index Cond: (package_id = 61)
  ->  Index Scan using manifest_pkey on manifest  (cost=0.15..8.17 rows=1 width=40)
        Index Cond: (id = manifest_index.manifest_id)

@crozzy crozzy force-pushed the delete-manifest-index-index branch from 3127b8f to e095551 Compare October 3, 2022 15:25
hdonnay
hdonnay previously approved these changes Oct 20, 2022
Copy link
Copy Markdown
Member

@hdonnay hdonnay left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

…d_idx

Currently, we have two indexes (manifest_index_manifest_id_package_id_dist_id_repo_id_idx
and manifest_index_unique) that cover the same data. As manifest_index_unique is chosen
by the query planner to service affected manifest queries and keeps the unique constraint,
and manifest_index_manifest_id_package_id_dist_id_repo_id_idx takes up a large amount of
storage, it is surplus to requirements.

Signed-off-by: crozzy <joseph.crosland@gmail.com>
@hdonnay hdonnay force-pushed the delete-manifest-index-index branch from e095551 to d9abe3d Compare October 20, 2022 15:41
@hdonnay hdonnay merged commit d9abe3d into quay:main Oct 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants