| 1 |
# |
| 2 |
# Showing the "ndb_fetch_table_stats" counter |
| 3 |
# |
| 4 |
# Since fetching table stats incurs one roundtrip to NDB it should not |
| 5 |
# be done more than strictly required, the "ndb_fetch_table_stats" |
| 6 |
# counter provides a means to check when table stats are fetched. |
| 7 |
CREATE TABLE t1 (a int primary key) ENGINE = NDB; |
| 8 |
INSERT INTO t1 VALUES (1); |
| 9 |
SELECT * FROM t1; |
| 10 |
a |
| 11 |
1 |
| 12 |
Table stats was fetched 1 time (expected 1) |
| 13 |
# Another query using an open handler instance should not cause |
| 14 |
# table stats to be fetched again |
| 15 |
SELECT * FROM t1; |
| 16 |
a |
| 17 |
1 |
| 18 |
Table stats was fetched 0 times (expected 0) |
| 19 |
# Closing handler, should really not need to fetch |
| 20 |
# table stats again, but they seem to be |
| 21 |
FLUSH TABLES t1; |
| 22 |
Table stats was fetched 1 times (oops! expected 0) |
| 23 |
# Running query again, should cause |
| 24 |
# table stats to be fetched once again |
| 25 |
SELECT * FROM t1; |
| 26 |
a |
| 27 |
1 |
| 28 |
Table stats was fetched 1 times (expected 1) |
| 29 |
DROP TABLE t1; |