crunching serialized data vs adding more fields - php - mysql -


okay, let's pretend i've got fifty pieces of information want store in each record of table. when pull data out, i'm going doing basic maths on of them. on given page request, i'm going pull out hundred records , calculations.

what performance impacts of:

a - storing data serialized array in single field , doing crunching in php

vs

b - storing data fifty numeric fields , having mysql sums , avgs instead

please assume normalization not issue in fifty fields. please assume don't need sort of these fields.

thanks in advance!

first, never store data serialized, it's not portable enough. perhaps in json encoded field, not serialized.

second, if you're doing data (searching, aggregating, etc), make them columns in table. , mean (sorting, etc).

the time it's acceptable store formatted data (serialized, json, etc) in column if it's read only. meaning you're not sorting on it, you're not using in clause, you're not aggregating data, etc.

database servers efficient @ doing set-based operations. if you're doing kind of aggregation (summing, etc), in mysql. it'll more efficient make php be...


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -