views:

55

answers:

2

I'm writing a Rails app that does a lot of calculations on imported pay-per-click advertising data. The imported logs, which contain records about impressions, clicks, conversions, etc. are all stored in one massive log table, which then needs to be joined with a conversions table to calculate cost per conversion, conversion rate for each campaign. Doing in in MySQL seems to be fast enough (400ms), but is there any reason to do this in the application rather than on the database layer?

Thanks!

+2  A: 

database for sure.
this is what a databases were invented for.

Col. Shrapnel
+1  A: 

The mysql mathematical expression parser is quite fast since it mostly calls low level c functions to do the math. However it does some rounding errors on large scale calculations which will be acceptable for most use cases.

SchlaWiener