EmmyMiao87 commented on issue #6370:
URL: 
https://github.com/apache/incubator-doris/issues/6370#issuecomment-891864215


   # Manually inject statistics
   
   ## grammar
   
   The statistical values that can be injected manually include: row_count, 
data_size etc。
   
   1. Manually inject statistics into the table
   
        ```sql
        ALTER TABLE table_name set stats ("key" = "value");
        ```
        
        For example: manually set the number of rows in the table store to 10000
        ```sql
        ALTER TABLE store set stats ("row_count" = "10000");
        ```
        After the update, you can see that the row count of the table store has 
been updated to 10000 by ``` show table stats store```.
        | table_name | row_count | data_size |
        | :--------- | --------- | --------- |
        | store      | **10000** | 1MB       |
   
   2. Manually inject column statistics
   
     ```sql
     ALTER TABLE table_name MODIFY COLUMN column_name set stats ("key" = 
"value");
     ```
   
     For example: manually set the num_distinct_value of the column s_store_sk 
of the table store to 5.
   
     ```sql
     ALTER TABLE store modify column s_store_sk set stats ("num_distinct_value" 
= "5");
     ```
   
     After the update, you can see that the num_distinct_value value of the 
column s_store_id of the table store is updated to 5.
   
   | column_name | num_distinct_value | min  | max  | num_nulls | avg_col_len | 
max_col_len |
   | ----------- | ------------------ | ---- | ---- | --------- | ----------- | 
----------- |
   | s_store_sk  | 10                 | 1    | 100  | 0         | 4           | 
4           |
   | s_store_id  | **5**              | -1   | -1   | -1        | 4           | 
4           |
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to