DotNet
DotNet

Reputation:

Heavy calculations in mysql

I'm using asp.net together with mysql and my site requires some quite heavy calculations on the data. These calculations are made with mysql, I thought it was easier to make the calculations in mysql to just be able to work with the data easy in asp.net and databind my gridviews and other data controls not using that much code.

But I start thinking I made a mistake making all calculations in the back because everything seems quite slow. In one of my queries I need to get data from several tables at once and add them together into my gridview so what I do in that query is:

Selecting from four different tables each having some inner joins. Then union them together using union all. Then some sum and grouping.

I can't post the full query here because its quite long. But do you think it's bad way to do the calculations like I've done? Should it be better doing them in asp.net? What is your opinion?

Upvotes: 0

Views: 213

Answers (3)

Quassnoi
Quassnoi

Reputation: 425843

MySQL does not allow embedded assembly, so writing a query which whill input a sequence of RGB records and output MPEG-4 is probably not the best idea.

On the other hand, it's good in summing or averaging.

Seeing what calculations you are talking about will surely help to improve the answer.

Self-update:

MySQL does not allow embedded assembly, so writing a query which whill input a sequence of RGB records and output MPEG-4 is probably not the best idea.

I'm really thinking how to implement this query, and worse than that: I feel it's possible :)

Upvotes: 1

Jaime
Jaime

Reputation: 6814

Without knowing the actual query, it sounds like you are doing relational/table work on your query, which RDMS are good at so it seems that your are doing it at the correct place... the problem may be on the optimization of the query, you may want to do "EXPLAIN(query)" and get an idea of the query plan that MySql is doing and try to optimize that way....

Upvotes: 0

C. Ross
C. Ross

Reputation: 31878

My experience with MySql is that it can be quite slow for calculations. I would suggest moving a substantial amount of work (particularly grouping and sum) to the ASP.NET. This has not been my experience with other database engines, but a 30 day moving average in MySQL seems quite slow.

Upvotes: 0

Related Questions