Skip to content

Commit 0cd0096

Browse files
committed
Bug#28658625 NDBINFO QUERY USED BY MEM PERFORMS BADLY 2/3
Backport of this fix to Cluster 7.5. Only the first two of the three patches are backported. Step 2: provide size estimates for all ndbinfo tables. Add a rows_estimate column to ndbinfo.ndb$tables. In Ndbinfo.hpp, add a std::function element to struct Ndbinfo::Table::Members, and in NdbinfoTables.cpp, add to each table declaration a function that will calcuate an estimated number of rows for the table. Each estimate is put into the rows_estimate column of ndb$tables, where the mysql server uses it to populate table statistics for the optimizer. Change-Id: I8e1e9502ea6f04cce76ff65440ae7e1518d6e542
1 parent 87a1ba1 commit 0cd0096

File tree

12 files changed

+421
-394
lines changed

12 files changed

+421
-394
lines changed

mysql-test/suite/ndb/r/ndbinfo.result

+8-7
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,11 @@ Table Create Table
3939
ndb$tables CREATE TABLE `ndb$tables` (
4040
`table_id` int(10) unsigned DEFAULT NULL,
4141
`table_name` varchar(512) DEFAULT NULL,
42-
`comment` varchar(512) DEFAULT NULL
42+
`comment` varchar(512) DEFAULT NULL,
43+
`rows_estimate` int(10) unsigned DEFAULT NULL
4344
) ENGINE=NDBINFO DEFAULT CHARSET=latin1 COMMENT='metadata for tables available through ndbinfo'
4445

45-
SELECT * FROM ndb$tables;
46+
SELECT table_id, table_name, comment FROM ndb$tables;
4647
table_id table_name comment
4748
0 tables metadata for tables available through ndbinfo
4849
1 columns metadata for columns available through ndbinfo
@@ -88,9 +89,9 @@ SELECT COUNT(*) FROM ndb$tables;
8889
COUNT(*)
8990
40
9091
SELECT * FROM ndb$tables WHERE table_id = 2;
91-
table_id table_name comment
92-
2 test for testing
93-
SELECT * FROM ndb$tables WHERE table_id > 5;
92+
table_id table_name comment rows_estimate
93+
2 test for testing 8000
94+
SELECT table_id, table_name, comment FROM ndb$tables WHERE table_id > 5;
9495
table_id table_name comment
9596
6 logbuffers logbuffer usage
9697
7 resources resources usage (a.k.a superpool)
@@ -127,7 +128,7 @@ table_id table_name comment
127128
38 processes Process ID and Name information for connected nodes
128129
39 config_nodes All nodes of current cluster configuration
129130
SELECT * FROM ndb$tables WHERE table_name = 'LOGDESTINATION';
130-
table_id table_name comment
131+
table_id table_name comment rows_estimate
131132
SELECT COUNT(*) FROM ndb$tables t, ndb$columns c
132133
WHERE t.table_id = c.table_id AND
133134
t.table_id in (1,2,3,4,5,6);
@@ -191,10 +192,10 @@ table_id column_id column_name
191192
0 0 table_id
192193
0 1 table_name
193194
0 2 comment
195+
0 3 rows_estimate
194196
1 0 table_id
195197
1 1 column_id
196198
1 2 column_name
197-
1 3 column_type
198199

199200
UPDATE ndb$tables SET table_id=2 WHERE table_id=3;
200201
ERROR HY000: Table 'ndb$tables' is read only

0 commit comments

Comments
 (0)