views:

121

answers:

1

Hi,

I have table where I track various statistics about site usage. Once a week, I plan to use these statistics and information from other tables to calculate various key indicators for use in multiple reports. This is in order not to have compute the complex data each time a report is accessed. These indicators will be stored in a separate table called "indicators".

There are approx. 50 indicators for 220 countries (i.e. a set of 50 for each country separately). Given that these figures are calculated weekly, I get the mind-boggling number of:

50 x 220 = 11,000 inserts/updates each week

My indicators table is structured in the following way:

id PK | type (TINYINT) | country_id (TINYINT) | year | week | value

... where I would basically insert/update 50 rows of different "type" per country.

What I'd like to ask is: am I going completely the wrong way here? Might I be better off setting the countries as columns instead of rows (220 columns...)? Or perhaps the indicators and lose some flexibility? How are such high volumes of inserts/updates generally dealt with?

Thanks in advance for your time.

CONCLUSION: Looks like this is clear enough, thanks for all the contributions.

+1  A: 

While I don't know your exact application, this shouldn't be problematic at all. Inserts and updates shouldn't be table locking. I doubt your users would even notice.

As a comparison, under load my mysql server peaks at nearly 3.5k queries / second.

Typically you'll want to run your maintenance scripts during periods of low use anyway.r

jasonbar