mysql performance in aggregation functions -


i wonder aggregate functions of mysql.

will following query:

select sum(c / 1000) t; 

have better performance than:

select sum(c) / 1000 t; 

when t big table?

i decided test this, have no idea definition of "big table" is.

for test case, used database table 1,063,527 rows of data in (again, data set may bigger)

the times follows;

select sum(field / 1000) table;

0.344   0.359   0.625   0.390   0.594   0.359 

select sum(field) / 1000 table;

0.234   0.390   0.219   0.438   0.203   0.485 

test conditions

for each of calls, changed division number in hope avoid "cache" result set different. /1000,999,998 etc.

i'm sure there people can far better checks , have far bigger tables query against, wanted try it.

conclusion

personally, don't see difference kind of ranges both produced - again, change when multiple data set (n)


Comments

Popular posts from this blog

php - Invalid Cofiguration - yii\base\InvalidConfigException - Yii2 -

How to show in django cms breadcrumbs full path? -

ruby on rails - npm error: tunneling socket could not be established, cause=connect ETIMEDOUT -