php - Best way to approach large MySQL Database organisation? -


i have question relating general approach pretty large mysql database. i've made php code interact database. i'm trying analyse hefty-ish set of data (~130k rows, 200 columns), , have been toying different methods so. i've been learning great deal along way, , feel though close getting setup really speedy, still bit stuck.

i began being firmly in 'excel' mindset. continually added more , more columns dataset, trying select various bits , pieces out purpose of statistical analysis. of php/mysql scripts had made took hours.

then, @ least basics working, learned joins. bit of revelation guess, resulted in me re-writing joins play nice data. net result massive increase in performance - took hours before takes 15 seconds now.

after chatting few people, came conclusion still make faster. way had set different samples of data each contained in different table. each table had it's data summarised in further table used part of joins - general info particular dataset stored in secondary table easy access , increase speed.

now, question have here this: better me change way database , application work these different samples of data combined single, large table? i've been experimenting far bit, , doesn't seem faster current method using.

in other words, better run lots of 'little' queries involving multi-table joins, doing @ moment, rather single, gigantic query involving multi-table joins? i've been examining execution time of queries , seems joins causing slow-down new method.

i under impression repeatedly sending small queries php mysql less optimal sending single query, there tipping point more complex queries not case? seem have reached point?

doing query optimization in php not way best performance out of db. formatted sql query , mysql's built-in query optimizer job better. (for example, query optimizer in mysql can things http://en.wikipedia.org/wiki/block_nested_loop)

but real answer depends on you're trying do. if speed number 1 priority, please list you're trying query , data schema. answers typically involve adding/removing indices , tweaking queries.

if keeping database footprint small goal (which highly doubt given how cheap disk space is), normalize everything.


Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -