Debian Codegraph @

mysql-test/suite/ndb_opt/check_index_stat_created.inc

raw
1 #
2 # Check if index stats have been created for a table
3 #
4 # Usage:
5 #
6 # let $index_stat_db=<db name>;
7 # let $index_stat_table=<table name>;
8 # source check_index_stats_created.inc;
9 #
10
11 disable_query_log;
12 if (`SELECT LENGTH('$index_stat_db') = 0`)
13 {
14 # Default is test
15 let $index_stat_db=test;
16 }
17 if (`SELECT LENGTH('$index_stat_table') = 0`)
18 {
19 # Default is t1
20 let $index_stat_table=t1;
21 }
22
23 let $root_name = '$index_stat_db/def/$index_stat_table';
24 # Get the id of an ordered index on the table
25 let $index_id =
26 query_get_value(SELECT id FROM ndbinfo.dict_obj_tree
27 WHERE root_name = $root_name AND type = 6, id, 1);
28
29 # Check the ndbinfo table to see if index stats have been created
30 eval SELECT CASE COUNT(*)
31 WHEN 0 THEN 'NO'
32 ELSE 'YES'
33 END AS stats_created
34 FROM ndbinfo.index_stats
35 WHERE index_id = $index_id;
36 enable_query_log;
37
38 # Clean up
39 let $index_stat_db=;
40 let $index_stat_table=;