Skip navigation links

MySQL Forums :: Performance :: Group By Perfomance MySQL vs MS SQL


Advanced Search

Re: Group By Perfomance MySQL vs MS SQL
Posted by: Jim Peterson ()
Date: November 13, 2009 11:10AM

First I miss copied the query into the post. It is a grouped by query:

select sum(amount) as amount,
account_id,
division_id,
department_id,
location_id,
entity_restrict_type,
entity_restrict_id,
entity_2_restrict_type,
entity_2_restrict_id,
cve_restrict_type,
cve_restrict_id,
date
from transactions
group by account_id,
division_id,
department_id,
location_id,
entity_restrict_type,
entity_restrict_id,
entity_2_restrict_type,
entity_2_restrict_id,
cve_restrict_type,
cve_restrict_id,
date;

Also it was 28 minutes not 2.8 minutes for MySQL and only 16 Seconds for MS SQL

First Time
1385340 rows in set (28 min 39.17 sec)

Second Time
1385340 rows in set (12 min 27.50 sec)

MS SQL 16 Seconds same results

MySQL Server RAM: 24G
MS SQL Server RAM: 4G


Total Row Count:
+----------+
| count(*) |
+----------+
| 4632437 |
+----------+


SHOW TABLE STATUS LIKE 'transactions'\G
SHOW VARIABLES LIKE '%buffer%';


mysql> SHOW TABLE STATUS LIKE 'transactions'\G
*************************** 1. row ***************************
Name: transactions
Engine: InnoDB
Version: 10
Row_format: Compact
Rows: 4656705
Avg_row_length: 132
Data_length: 617611264
Max_data_length: 0
Index_length: 1376256000
Data_free: 649068544
Auto_increment: NULL
Create_time: 2009-11-13 09:05:54
Update_time: NULL
Check_time: NULL
Collation: latin1_swedish_ci
Checksum: NULL
Create_options:
Comment: TRA accounting trasnactions
1 row in set (0.67 sec)

mysql> SHOW VARIABLES LIKE '%buffer%';
+-------------------------+------------+
| Variable_name | Value |
+-------------------------+------------+
| bulk_insert_buffer_size | 8388608 |
| innodb_buffer_pool_size | 1572864000 |
| innodb_change_buffering | inserts |
| innodb_log_buffer_size | 8388608 |
| join_buffer_size | 131072 |
| key_buffer_size | 8384512 |
| myisam_sort_buffer_size | 8388608 |
| net_buffer_length | 16384 |
| preload_buffer_size | 32768 |
| read_buffer_size | 131072 |
| read_rnd_buffer_size | 262144 |
| sort_buffer_size | 2097144 |
| sql_buffer_result | OFF |
+-------------------------+------------+

The execution plan for MS SQL shows that it is using a Hash Match. Is there anything like that in MySQL?

Options: ReplyQuote


Subject Views Written By Posted
Group By Perfomance MySQL vs MS SQL 232 Jim Peterson 11/11/2009 10:15AM
Re: Group By Perfomance MySQL vs MS SQL 152 Rick James 11/12/2009 07:06PM
Re: Group By Perfomance MySQL vs MS SQL 132 Jim Peterson 11/13/2009 11:10AM
Re: Group By Perfomance MySQL vs MS SQL 79 Rick James 11/17/2009 10:30PM


Sorry, only registered users may post in this forum.