mariadb/storage
Annamalai Gurusami b5299f3559 Bug #18806829 OPENING INNODB TABLES WITH MANY FOREIGN KEY REFERENCES IS
SLOW/CRASHES SEMAPHORE

Problem:

There are 2 lakh tables - fk_000001, fk_000002 ... fk_200000.  All of them
are related to the same parent_table through a foreign key constraint.
When the parent_table is loaded into the dictionary cache, all the child table
will also be loaded.  This is taking lot of time.  Since this operation happens
when the dictionary latch is taken, the scenario leads to "long semaphore wait"
situation and the server gets killed.

Analysis:

A simple performance analysis showed that the slowness is because of the
dict_foreign_find() function.  It does a linear search on two linked list
table->foreign_list and table->referenced_list, looking for a particular
foreign key object based on foreign->id as the key.  This is called two
times for each foreign key object.

Solution:

Introduce a rb tree in table->foreign_rbt and table->referenced_rbt, which
are some sort of index on table->foreign_list and table->referenced_list
respectively, using foreign->id as the key.  These rbt structures will be
solely used by dict_foreign_find().  

rb#5599 approved by Vasil
2014-06-10 09:35:50 +05:30
..
archive Description: When we execute a correlated subquery on an 2014-04-10 11:10:31 +05:30
blackhole
csv
example Updated/added copyright headers 2014-01-06 10:52:35 +05:30
federated Bug #16324629 : SERVER CRASHES ON UPDATE/JOIN FEDERATED + 2013-12-30 11:39:55 +05:30
heap Updated/added copyright headers 2014-01-06 10:52:35 +05:30
innobase Bug #18806829 OPENING INNODB TABLES WITH MANY FOREIGN KEY REFERENCES IS 2014-06-10 09:35:50 +05:30
myisam Bug #18045646 LOCAL USER CAN RUN ARBITRARY CODE IN THE CONTEXT OF THE MYSQL SERVER 2014-05-08 14:41:01 +05:30
myisammrg Updated/added copyright header. Added line "use is subject to license terms" 2014-02-17 18:19:04 +05:30
ndb Updated/added copyright header. Added line "use is subject to license terms" 2014-02-17 18:19:04 +05:30
perfschema Updated/added copyright header. Added line "use is subject to license terms" 2014-02-17 18:19:04 +05:30