-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
infoschema: optimize 'select count(*) from information_schema.tables' for v2 #55574
Conversation
Hi @tiancaiamao. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #55574 +/- ##
=================================================
- Coverage 72.7958% 56.4415% -16.3543%
=================================================
Files 1588 1716 +128
Lines 443469 621216 +177747
=================================================
+ Hits 322827 350624 +27797
- Misses 100772 246943 +146171
- Partials 19870 23649 +3779
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/retest |
@tiancaiamao: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/retest |
@tiancaiamao: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/test check-dev |
@tiancaiamao: Cannot trigger testing until a trusted user reviews the PR and leaves an In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
/ok-to-test |
Is |
IterateAllTableItems(visit func(infoschema.TableItem) bool) | ||
}) | ||
if ok { | ||
if x := ctx.Value("cover-check"); x != nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe use a failpoint
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMO, failpoint is not as convient sometimes.
- It works globally, so there's no good way for precise control with a specific query.
- It requires
make failpoint-enable
, an extra step to enable the test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It requires make failpoint-enable, an extra step to enable the test
I have added this feature for failpoint, it can be configurated with our other testing command line arguments like --tags=intest
or -race
https://github.com/pingcap/failpoint?tab=readme-ov-file#quick-start-use-failpoint-toolexec
select table_name from information_schema.tables where table_name = 't'; | ||
explain format='brief' select table_name, table_schema from information_schema.tables; | ||
select count(*) from information_schema.tables where table_name = 't'; | ||
select count(table_name) from information_schema.tables where table_name = 't'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
select count(table_name) from information_schema.tables where table_name = 't'; | |
select count(table_name) from information_schema.tables where table_name = 't'; | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fixdb, lance6716, tangenta The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What problem does this PR solve?
Issue Number: close #55515
ref #50959
Problem Summary:
What changed and how does it work?
Make a special optimization for reading
INFORMATION_SCHEMA.TABLES
, that is, if onlytable_name
ortable_schema
are visited, make the query pure in-memory operation.I tried to supportselect count(*)
but found that the aggregation always use the first column for*
, and in that case for INFORMATION_SCHEMA.TABLES, the column istable_catalog
. And changing theselect count(*)
to using other columns seems more difficult than I thought.Check List
Tests
Test with 1M tables:
Without this optimize:
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.