Addressing issue #2987 - Adding missing indexes for jobs view and correcting small bug #3024
+67
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes: #2987
Solution
Lack of indexes to jobs tables were causing a slowdown on the queries related to jobs. This pull request includes changes to improve database handling and performance in the Marquez application. The most important changes include modifying error handling during database migration, adding indexes to various tables to optimize queries, and creating a new view for jobs.
Database optimization:
api/src/main/resources/marquez/db/migration/V75_1__AddJobTableIndexes.sql
: Added multiple indexes to thejobs
,job_facets
,runs
,jobs_tag_mapping
,tags
,namespaces
, andjob_versions
tables to improve query performance for jobs.View creation:
api/src/main/resources/marquez/db/migration/V75_2__CreateJobsView.sql
: Created or replaced thejobs_view
to include various job details, optimizing the way job data is queried and displayed.Error handling:
api/src/main/java/marquez/MarquezApp.java
: Modified therun
method to throw aFlywayException
with a detailed message instead of logging and callingonFatalError
when a database migration error occurs. When this error occurs, the application will now display the error message instead of a generic "Stopping app" message.One-line summary: Added missing indexes for jobs view that were taking a long time to be displayed.
Checklist
CHANGELOG.md
(Depending on the change, this may not be necessary)..sql
database schema migration according to Flyway's naming convention (if relevant)