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

[refactor](statistic) fetch statistic data with catalog and database id (#33928) #34202

Merged
merged 1 commit into from
Apr 27, 2024

Conversation

morningman
Copy link
Contributor

bp (#33928)

…id (apache#33928)

In previously, all statistic tables have a column named `id`.
This column is combined with `tableId` and `indexId`.
Because table's id is unique globally, so we can query statistic table by only `id`
to fetch the table's statistic data.

By for external table, the table's id may not be unique globally. For example, the table id
may only be unique within a database. So we need more predicates to fetch the right statistic data.

In this PR, I changed all query statements of statistic table, by adding `catalog_id` and `database_id` conditions.
For example:

```
SELECT * FROM 
column_statistics
WHERE `id` = '${id}' AND `catalog_id` = '${catalogId}' AND `db_id` = '${dbId}'
```

The content of `id` column in statistic tables remain unchanged, so that after user upgrade Doris,
the existing statistic data can still be used.
@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@morningman morningman merged commit 4b97720 into apache:branch-2.1 Apr 27, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants