[MDEV-8132] Temporary Tables using Aria with very poor performance Created: 2015-05-11  Updated: 2018-02-17  Resolved: 2018-02-17

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - Aria
Affects Version/s: 10.0.18, 10.1.4
Fix Version/s: 10.1.32, 10.2.14, 10.3.5

Type: Bug Priority: Major
Reporter: Venâncio Ferreira Assignee: Michael Widenius
Resolution: Fixed Votes: 2
Labels: None
Environment:

Centos 6.6, SSD Hard Drive, 6Gb of Ram, Intel Xeon L5640


Issue Links:
Relates
relates to MDEV-5841 Mariadb very poor temporary performance Closed
relates to MDEV-9079 Aria very slow for internal temporary... Closed
Sprint: 10.1.30, 5.5.59, 10.0.34

 Description   

Hello,

I have tested this with MariaDB 10.0 and 10.1, and the result is the same.

Creating a temporary table using Aria is a lot slower than using MyISAM.
I'll gives here some examples.

Creating a Temporary Table of ~800Mb using MyISAM
MariaDB [admin_fnf_beta]> CREATE TEMPORARY TABLE table9 engine=MyISAM AS (SELECT * FROM ibf_forums_posts);
Query OK, 1576320 rows affected (11.51 sec)
Records: 1576320 Duplicates: 0 Warnings: 0

Creating a Temporary Table of ~800Mb using Aria with default pagecache buffer
MariaDB [admin_fnf_beta]> CREATE TEMPORARY TABLE table10 engine=Aria AS (SELECT * FROM ibf_forums_posts);
Query OK, 1576320 rows affected (19.71 sec)
Records: 1576320 Duplicates: 0 Warnings: 0

Creating a Temporary Table of ~800Mb using Aria with 1GB pagecache buffer
MariaDB [admin_fnf_beta]> CREATE TEMPORARY TABLE table10 engine=Aria AS (SELECT * FROM ibf_forums_posts);
Query OK, 1576320 rows affected (16.53 sec)
Records: 1576320 Duplicates: 0 Warnings: 0

As you can see, Aria is faster using the pagecache buffer for the temporary table, but its still slower than MyISAM using the disk.

This also happens with small temporary tables.
Example:

Creating a Temporary Table of ~7Mb using MyISAM
MariaDB [admin_fnf_beta]> CREATE TEMPORARY TABLE table2 engine=MyISAM AS (SELECT * FROM ibf_forums_topics);
Query OK, 57492 rows affected (0.44 sec)
Records: 57492 Duplicates: 0 Warnings: 0

Creating a Temporary Table of ~7Mb using Aria with default pagecache buffer
MariaDB [admin_fnf_beta]> CREATE TEMPORARY TABLE table3 engine=Aria AS (SELECT * FROM ibf_forums_topics);
Query OK, 57492 rows affected (0.62 sec)
Records: 57492 Duplicates: 0 Warnings: 0

This issue becomes more important because we can't change the default internal temporary table storage engine. Its defaulted to Aria and we can only change it if we recompile MariaDB.



 Comments   
Comment by Axel Schwenke [ 2017-12-19 ]

Added a test case for ARIA writes to the regression test suite.

Comment by Dimitris Chatzis [ 2017-12-20 ]

Issue exist also for MariaDB 10.2

Comment by Dimitris Chatzis [ 2018-01-04 ]

After two years MariaDB start checking an easy to reproduce problem and it seems that it will take 2 more years for a fix

Comment by Michael Widenius [ 2018-01-18 ]

Working for a fix to improve the insert speed for PAGE format.

While testing I did found out that find out where to put a row in PAGE format took way too long time.
I have fixed this by limiting the search area in the bitmap. The fix should be pushed to 10.2 or 10.3 soon.

Note that PAGE format will always be slower on insert, but it should have an advantage if one is
doing ORDER BY or GROUP BY on the table, as FIXED or DYNAMIC format will do a system call for each row while PAGE is normally cached.

Comment by Dimitris Chatzis [ 2018-01-18 ]

"The fix should be pushed to 10.2 or 10.3 soon."

What about 10.1 ?

Comment by Dimitris Chatzis [ 2018-02-07 ]

10.1.31 is out but don't have that fix

Any info if the fix will be on the next version or if it will take too long to add it?

Comment by Sergei Golubchik [ 2018-02-12 ]

The fix already exists, adding it to any version takes minutes.

But it's a rather extensive change, so the question we're considering now is whether it's sufficiently safe to add it to 10.1-GA or not. The testing so far didn't show any problems, so it might go into 10.1 after all.

Comment by Dimitris Chatzis [ 2018-02-12 ]

Thanks for your reply !

"The fix already exists"

You mean that it is already included at 10.2.x and 10.3.x and not yet at 10.1.x ?

As i didn't see that info at the changelog related to that....

Also if you decide to add it at 10.1.x as it was not cause any issues is a month enough so you can add it on the next version of 10.1.x ?

Comment by Michael Widenius [ 2018-02-17 ]

Fixed performance problem with Aria by speeding up find_head().

The result of this patch is a up to 2x or more speed up for inserts without keys for
format PAGE.

Generated at Thu Feb 08 07:24:52 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.