Efficiency of 3 mysql selects vs 1 in php -


what's difference between these time-complexity wise?

mysql_query("select * table id = 0 or id = 1 or id = 2"); 

and

mysql_query("select * table id = 0"); mysql_query("select * table id = 1"); mysql_query("select * table id = 2"); 

how scale lot of rows in table?

how scale lot of mysql_query calls instead of three?

i'm wondering if it's more inefficient multiple calls instead of 1 , how scales.

i had similar question while back, inserts. here's answer provided, looked , applies mysql equally mssql.

much of overhead of mysql query development of execution plan. if single select, have develop execution plan 1 (1) time; if 512 seperate selects, have develop execution plan 512 times. considerably less overhead single select.

i think general knowledge broad answer looking for. in general, want make few connections database (because causes overhead), , few queries possible (because many queries = calculating many execution plans, more overhead)


Comments

Popular posts from this blog

shopping cart - Page redirect not working PHP -

php - How to modify a menu to show sub-menus -

python - Installing PyDev in eclipse is failed -