JOIN constructors takes a long time in 5.3
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
MariaDB |
Fix Released
|
High
|
Michael Widenius |
Bug Description
I run sysbench on MariaDB on Windows with Visual Studio sampling profiler , comparing 5.2 and 5.3 performance.
sysbench version is 0.5 and for the test I created select1.lua, which does nothing else but running prepared "SELECT 1".
Performance reports show a big difference inside JOIN constructor, and for this specific test JOIN::JOIN is the most expensive function with 24.23% exclusive samples.
Here is he list of functions that show up as more expensive in 5.3 compared to 5.2
Comparison Column Delta Baseline Value Comparison Value
JOIN::JOIN 23,15 1,08 24,23
RtlpAllocateHeap 3,24 0,00 3,24
RtlpInsertFreeBlock 1,93 0,00 1,93
RtlpFreeHeap 1,42 0,00 1,42
Looking at what has changed from 5.2 to 5.3, JOIN structure grew from around 5K to around 32K. Besides, it contains 2 large arrays of POSITION structures, and POSITION has a non-trivial constructor, since it includes semi-join strategy classes for which virtual function tables must be setup (confirmed by switching to disassembly and single-stepping through JOIN::JOIN)
Related branches
Changed in maria: | |
assignee: | nobody → Sergey Petrunia (sergefp) |
milestone: | none → 5.3 |
Changed in maria: | |
importance: | Undecided → Critical |
Changed in maria: | |
status: | New → Incomplete |
status: | Incomplete → In Progress |
Changed in maria: | |
assignee: | Sergey Petrunia (sergefp) → Michael Widenius (monty) |
importance: | Critical → High |
Profiling with another test (point_select) shows the same slowdown in JOIN::JOIN. Second expensive call as compared to subquery_ plan.
5.2 is JON::choose_
Comparison Delta Baseline Value Comparison Value subquery_ plan 3,47 0,00 3,47
JOIN::JOIN 7,83 0,42 8,25
JOIN::choose_
ut_delay 1,55 0,00 1,55
memcpy 1,35 0,00 1,35
RtlpAllocateHeap 1,28 0,00 1,28
For JOIN::choose_ subquery_ plan function, profiler points at the line at the very start of the function
Join_plan_state save_qep; /* The original QEP of the subquery. */
I suspect that the bottleneck here could be again initialization of the POSITION structures in the best_positions array in
Join_plan_state