﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
25377	Regression in expressions refactor causes database queries to run  COUNT('*') instead of COUNT(*)	Adam Johnson	nobody	"Performance regression on 1.8 expression refactor. Count stopped outputting `COUNT(*)` and started outputting `COUNT('*')` due to using a `Value`. Possibly unnoticed until now because it doesn't affect the most popular database options much - I can't measure a performance drop for this on MySQL / InnoDb.

However I have managed to measure a performance drop on MariaDB + Aria (=MySQL fork + MyISAM fork):

{{{
adamj@localhost [3]> select count(*) from count_test;
+----------+
| count(*) |
+----------+
|    10000 |
+----------+
1 row in set (0.00 sec)

adamj@localhost [10]> select benchmark(100 * 1000 * 1000, (select count(*) from count_test));
+-----------------------------------------------------------------+
| benchmark(100 * 1000 * 1000, (select count(*) from count_test)) |
+-----------------------------------------------------------------+
|                                                               0 |
+-----------------------------------------------------------------+
1 row in set (0.86 sec)

adamj@localhost [11]> select benchmark(100 * 1000 * 1000, (select count('*') from count_test));
+-------------------------------------------------------------------+
| benchmark(100 * 1000 * 1000, (select count('*') from count_test)) |
+-------------------------------------------------------------------+
|                                                                 0 |
+-------------------------------------------------------------------+
1 row in set (1.23 sec)

}}}

This is because MyISAM / Aria store the count in a metadata variable but once you introduce the expression it figures it has to do a table scan. The situation would of course only get worse with more rows, 10000 is tiny."	Cleanup/optimization	closed	Database layer (models, ORM)	1.8	Release blocker	fixed			Accepted	1	0	0	0	0	0
