Monday, 15 February 2010

performance - Updating a mySQL table efficiently? -



performance - Updating a mySQL table efficiently? -

i'm looking bit of general advice on approach here.

say have table layout like:

name | 1hr | 2hr | 3hr | 4hr --------------------------------- joe | 23 | 12 | 45 | 9

the hours refer hr ago. or 3 hours ago. , updating info every hour. i'll doing many rows. each time update move values right. 1hr becomes 2hr etc. , 1hr inserted new.

my questions this, instead of updating each cell , new value inserted efficient way of doing this? using java , jdbc command these operations.

my initial though treat circular array. have cell hold pointer start. result in 2 updates per operations vs 4.

is approach or there better?

the improve approach store table:

name | time | value -------------------- joe | 10:00 | 9 joe | 11:00 | 45 joe | 12:00 | 12 joe | 13:00 | 23

then don't have anything update, add together new row when want add together value.

mysql performance computer-science database-administration

No comments:

Post a Comment