SQL Working time and php
Posted: Thu Sep 24, 2009 9:36 am
Hey guys,
I've been thinking about what kinds query are faster and what kinds of query are slower in general terms?
Example:
What would be faster:
1)
SELECT id FROM table_name WHERE email = 'example@email.com'
SELECT address FROM another_table WHERE id_person = 'some id'
OR
2)
SELECT a.id, b.address FROM table_name a, another_table b WHERE a.email = 'example@email.com', b.id_person = 'some_id'
In this case we've got 2 queries performed seperatly and the same result in only 1 query.
I know, this example, just like that, almost doesn't make sense, this is an example only!
May be there are some queries I should avoid using?
If I'm missing something, please tell me and/or correct me
I am really newbe at this...
Thanks for your help
I've been thinking about what kinds query are faster and what kinds of query are slower in general terms?
Example:
What would be faster:
1)
SELECT id FROM table_name WHERE email = 'example@email.com'
SELECT address FROM another_table WHERE id_person = 'some id'
OR
2)
SELECT a.id, b.address FROM table_name a, another_table b WHERE a.email = 'example@email.com', b.id_person = 'some_id'
In this case we've got 2 queries performed seperatly and the same result in only 1 query.
I know, this example, just like that, almost doesn't make sense, this is an example only!
May be there are some queries I should avoid using?
If I'm missing something, please tell me and/or correct me
I am really newbe at this...
Thanks for your help