I looked at this PHP DB library called NotORM , and after reading its documents, I read about its stand at the associations. The argument was mainly the performance of a single SQL query with joins and the use of multiple select queries, and then cross-referencing the results at the DB abstraction level.
I always knew that single queries should always be better than using multiple queries, so the idea of ββNotORM was new to me. I'm also not sure, because only in NotORM did I see this "function".
I would like to ask you guys about your opinion on this.
Which query is better and faster?
It...
SELECT application.*, tag.* FROM application LEFT JOIN application_tag ON application.id = application_tag.application_id LEFT JOIN tag ON application_tag.tag_id = tag.id ORDER BY application.id
compared with...
SELECT * FROM application LIMIT 4; SELECT * FROM application_tag WHERE application_id IN ('1', '2', '3', '4'); SELECT * FROM tag WHERE id IN ('21', '22', '23', '24');
Is this second method really practical?
source share