php - Big joins or multiple fetches most efficent? -


i understand multiple variables part of equation number of tables, number of columns, number of returned rows, used indexes etc. if speak overall

is more efficient run query multiple (say 5+) joins of tables contain rows information corresponding rows in main table , returned result in 20.000 rows range. sake of argument let's first table contain users creation date , it's on date decide users pick out. other tables contain stuff such session information, user notes etc. users should picked out depending on values of fields in secondary tables might ignore session data 1 user , work session data on user when go through results. way needed data in 1 query might redundant data users @ same time.

or more efficient pick users date , when iterating results fetch data other tables per user when it's necessary?

let's work on returned rows done within php5+.

i'll say, benchmark.

it depends on frequency of "when it's necessary". if need date 10% of users, seconde approach better think. if need them 90%, better retrieve in 1 big query.


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -