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

destination-snowflake: speed up metadata queries #45422

Conversation

stephane-airbyte
Copy link
Contributor

@stephane-airbyte stephane-airbyte commented Sep 12, 2024

What

This change improves the performance of metadata queries in the Snowflake destination connector by optimizing how table information is retrieved and processed.

How

  • Replaced queries to information_schema with SHOW TABLES and DESCRIBE TABLE commands for faster metadata retrieval. This should also reduce the cost for customers by reduce the use of warehouses
  • Updated methods like getFinalTableRowCount, findExistingTables, and getTable to use the new querying approach
  • Modified the V1V2 migrator to use the optimized table information retrieval

Review guide

  1. SnowflakeDestinationHandler.kt
  2. SnowflakeV1V2Migrator.kt
  3. SnowflakeInternalStagingLowercaseDatabaseTypingDedupingTest.kt

User Impact

Users should experience faster sync operations, especially for connections with a large number of tables or columns. This optimization reduces the time spent on metadata queries, leading to improved overall performance.

Copy link

vercel bot commented Sep 12, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
airbyte-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 18, 2024 9:10pm

Copy link
Contributor Author

stephane-airbyte commented Sep 12, 2024

@stephane-airbyte stephane-airbyte force-pushed the stephane/09-11-destination-snowflake_speed_up_metadata_queries branch from 115827f to aed93b6 Compare September 12, 2024 16:44
@octavia-squidington-iii octavia-squidington-iii added the CDK Connector Development Kit label Sep 12, 2024
@stephane-airbyte stephane-airbyte force-pushed the stephane/09-11-destination-snowflake_speed_up_metadata_queries branch from aed93b6 to c972312 Compare September 12, 2024 16:51
@stephane-airbyte stephane-airbyte changed the base branch from stephane/09-10-destination-snowflake_bump_cdk to stephane/05-22-fix_destination_state_table_collation_for_snowflake September 12, 2024 16:51
@stephane-airbyte stephane-airbyte force-pushed the stephane/05-22-fix_destination_state_table_collation_for_snowflake branch from 98467d3 to dbe2fb1 Compare September 12, 2024 17:28
@stephane-airbyte stephane-airbyte force-pushed the stephane/09-11-destination-snowflake_speed_up_metadata_queries branch 2 times, most recently from 765a6cc to ea13c79 Compare September 12, 2024 19:37
@stephane-airbyte stephane-airbyte force-pushed the stephane/05-22-fix_destination_state_table_collation_for_snowflake branch from dbe2fb1 to 108ff38 Compare September 12, 2024 21:38
@stephane-airbyte stephane-airbyte force-pushed the stephane/09-11-destination-snowflake_speed_up_metadata_queries branch from ea13c79 to eb88eff Compare September 12, 2024 21:39
@stephane-airbyte stephane-airbyte force-pushed the stephane/09-11-destination-snowflake_speed_up_metadata_queries branch from eb88eff to 36f59f1 Compare September 12, 2024 22:48
@stephane-airbyte stephane-airbyte force-pushed the stephane/09-11-destination-snowflake_speed_up_metadata_queries branch from afe55f2 to 5e9b9c1 Compare September 17, 2024 21:42
@stephane-airbyte stephane-airbyte force-pushed the stephane/05-22-fix_destination_state_table_collation_for_snowflake branch from 1a5341c to 0aa0378 Compare September 17, 2024 21:44
@stephane-airbyte stephane-airbyte force-pushed the stephane/09-11-destination-snowflake_speed_up_metadata_queries branch from 5e9b9c1 to 1a20860 Compare September 17, 2024 21:44
@stephane-airbyte stephane-airbyte force-pushed the stephane/05-22-fix_destination_state_table_collation_for_snowflake branch from 0aa0378 to a9d0815 Compare September 18, 2024 00:35
@stephane-airbyte stephane-airbyte force-pushed the stephane/09-11-destination-snowflake_speed_up_metadata_queries branch from 1a20860 to 05cc92b Compare September 18, 2024 00:35
@stephane-airbyte stephane-airbyte marked this pull request as ready for review September 18, 2024 02:21
@stephane-airbyte stephane-airbyte requested review from a team September 18, 2024 02:21
@stephane-airbyte stephane-airbyte force-pushed the stephane/09-11-destination-snowflake_speed_up_metadata_queries branch from 05cc92b to 09fb99c Compare September 18, 2024 02:28
@octavia-squidington-iii octavia-squidington-iii removed the CDK Connector Development Kit label Sep 18, 2024
@stephane-airbyte stephane-airbyte changed the base branch from stephane/05-22-fix_destination_state_table_collation_for_snowflake to graphite-base/45422 September 18, 2024 18:20
@stephane-airbyte stephane-airbyte force-pushed the stephane/09-11-destination-snowflake_speed_up_metadata_queries branch from 09fb99c to 1b5edad Compare September 18, 2024 18:47
@stephane-airbyte stephane-airbyte changed the base branch from graphite-base/45422 to master September 18, 2024 18:47
@stephane-airbyte stephane-airbyte force-pushed the stephane/09-11-destination-snowflake_speed_up_metadata_queries branch from 1b5edad to d2c938a Compare September 18, 2024 18:47
@stephane-airbyte stephane-airbyte force-pushed the stephane/09-11-destination-snowflake_speed_up_metadata_queries branch from d2c938a to dfd8fd1 Compare September 18, 2024 20:56
Copy link
Contributor

@edgao edgao left a comment

Choose a reason for hiding this comment

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

seems convincing, feels a bit risky? (lmk if you disagree, I'm not familiar with how these queries behave)

maybe worth running a prerelease image just as a failsafe? (i.e. check that the sync succeeds + doesn't trigger a soft reset)

@stephane-airbyte stephane-airbyte merged commit 14f9e5c into master Sep 18, 2024
36 checks passed
Copy link
Contributor Author

Merge activity

@stephane-airbyte stephane-airbyte deleted the stephane/09-11-destination-snowflake_speed_up_metadata_queries branch September 18, 2024 22:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/connectors Connector related issues area/documentation Improvements or additions to documentation connectors/destination/snowflake
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants