Improve dbt seed times by removing type lookup and casting during INSERT#493
Closed
nrichards17 wants to merge 1 commit into
Closed
Improve dbt seed times by removing type lookup and casting during INSERT#493nrichards17 wants to merge 1 commit into
nrichards17 wants to merge 1 commit into
Conversation
… when loading dbt seeds.
Collaborator
|
@nrichards17 I'm on vacation next week, but I'll run this change against our test suite when I get back, and assuming it passes, will try to sneak it in before I release 1.7.0. |
Collaborator
|
Thanks for the PR, appreciate it. |
Contributor
Author
|
happy to help, thank you @benc-db ! |
Collaborator
|
Closing in favor of 498 which can run against our infra. Thanks @nrichards17! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Resolves #476
Description
Several users have noticed slow run times for loading dbt seeds with >1k records when using the
dbt-databricksadapter, with run times becoming prohibitively slow for seeds with >10k records. This PR speeds up that run time substantially by removing unnecessary type lookup and casting during theINSERTstatement.DBT seeds essentially are built in two steps:
CREATE TABLE AS ...INSERT OVERWRITE INTO table.schema VALUES ...For some reason in the second step, there is both a type lookup and subsequent
CAST(x) AS typefor every single value (rows x columns) in the seed. This is effectively redundant and unnecessary, since the type information was already used when defining the column types during table creation.Removing these steps significantly speeds up the seed run times. For example, I was able to load a seed with 47k records and 9 columns in about 1 minute with this change, whereas previously the seed hadn't even finished after 10+ minutes of loading.
Checklist
CHANGELOG.mdand added information about my change to the "dbt-databricks next" section.