Benchmarking Aria
Non c'è stato ancora il tempo per eseguire dei benchmark appropriati su Aria. Seguono alcuni argomenti che sono stati discussi nella mailing liste maria-discuss.
Aria utilizzato per le tabelle temporanee interne
Per default viene usato Aria (invece di MyISAM) per le tabelle temporanee interne, quando le tabelle MEMORY superano le dimensioni massime e devono essere scritte su disco, oppure non è possibile utilizzare lo Storage Engine MEMORY (per esempio quando si hanno risultati temporanei con i campi BLOB). Nella maggior parte dei casi Aria dovrebbe fornire prestazioni migliori rispetto a MyISAM, ma non è sempre vero.
CREATE TABLE `t1` (`id` int(11) DEFAULT NULL, `tea` text) ENGINE=MyISAM DEFAULT CHARSET=latin1; insert t1 select rand()*2e8, repeat(rand(), rand()*64) from t1;
Si provi a ripetere l'ultima riga fino ad ottenere 2097152 record.
Le query testate:
Q1: SELECT id, tea from t1 group by left(id,1) order by null; Q2: SELECT id, count(*), tea from t1 group by left(id,1) order by null; Q3: SELECT id, tea from t1 group by left(id,2) order by null; Q4: SELECT id, count(*), tea from t1 group by left(id,2) order by null; Q5: SELECT id, tea from t1 group by id % 100 order by null; Q6: SELECT id, count(*), tea from t1 group by id % 100 order by null;
Risultati (tempi in secondi, i più bassi sono i migliori):
Test | Aria, pagine di 8K | Aria, pagine di 2K | MyISAM |
---|---|---|---|
Q1 | 3.08 | 2.41 | 2.17 |
Q2 | 6.24 | 5.21 | 12.89 |
Q3 | 4.87 | 4.05 | 4.04 |
Q4 | 8.20 | 7.04 | 15.14 |
Q5 | 7.10 | 6.37 | 6.28 |
Q6 | 10.38 | 9.09 | 17.00 |
La buona notizia è che, per le normali query GROUP BY che usano funzioni aggreganti, l'uso di Aria per le tabelle temporanee interne comporta un miglioramento delle prestazioni che si avvicina al 50%.
Si noti che le query Q1, Q3 e Q5 non sono comandi comuni e non viene utilizzata la somma. In questo caso le righe vengono semplicemente scritte nella tabella temporanea e non vengono modificate. Ma se vi sono funzioni aggreganti e aggiornamenti il nuovo formato di Aria velocizza quasi del 50%.
The above table also shows how the page size affects the performance. The reason for the difference is that there is more data to move back/from the page cache for inserting of keys. (When reading data we are normally not copying pages). The bigger page size however allows longer keys and fewer index levels so for bigger data sets the different should be smaller. It's possible to in the future optimize Aria to not copy pages from the page cache also for index writes and then this difference should disappear.
The default page size for Aria is 8K.
If you want to run MariaDB with MyISAM for temporary tables, don't use the configure option '--with-aria-tmp-tables' when building MariaDB.