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

feat: introduce information schema provider cache #3208

Merged
merged 1 commit into from
Jan 22, 2024

Conversation

WenyXu
Copy link
Member

@WenyXu WenyXu commented Jan 20, 2024

I hereby agree to the terms of the GreptimeDB CLA

What's changed and what's your intention?

Each time invoking the self.system_catalog.table(catalog, schema, table_name), the system_catalog makes a new InformationSchemaProvider, which is time-consuming.

If we execute the SELECT * FROM information_schema. tables;, each self.system_catalog.table(catalog, schema, table_name) invoking will take ~30ms, resulting in query will spend ~500ms. The key problem here:

  let sys_tables = try_stream!({
      // System tables
      let sys_table_names = self.system_catalog.table_names(schema);
      for table_name in sys_table_names {
          if let Some(table) = self.system_catalog.table(catalog, schema, &table_name) { // <- This invoking
              yield table;
          }
      }
  });

BTW, I checked the behavior on the cloud, and the information_schema doesn't work.

Checklist

  • I have written the necessary rustdoc comments.
  • I have added the necessary unit tests and integration tests.
  • This PR does not require documentation updates.

Refer to a related PR or issue link (optional)

@github-actions github-actions bot added docs-not-required This change does not impact docs. Size: S labels Jan 20, 2024
@WenyXu WenyXu marked this pull request as draft January 20, 2024 16:29
@WenyXu WenyXu force-pushed the fix/sys-catalog branch 2 times, most recently from 07db1ca to c237959 Compare January 20, 2024 16:48
@WenyXu WenyXu changed the title fix: remove redundant invoking feat: introduce information schema provider cache Jan 20, 2024
@WenyXu WenyXu marked this pull request as ready for review January 20, 2024 16:51
Copy link

codecov bot commented Jan 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (440cd00) 85.86% compared to head (7a73a55) 85.39%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3208      +/-   ##
==========================================
- Coverage   85.86%   85.39%   -0.47%     
==========================================
  Files         839      839              
  Lines      137421   137447      +26     
==========================================
- Hits       117990   117369     -621     
- Misses      19431    20078     +647     

Copy link
Contributor

@shuiyisong shuiyisong left a comment

Choose a reason for hiding this comment

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

🚀

@waynexia waynexia added this pull request to the merge queue Jan 22, 2024
Merged via the queue into GreptimeTeam:main with commit de13de1 Jan 22, 2024
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs-not-required This change does not impact docs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants