I've recently been beavering away at writing database classes that return multi-dimensional arrays of objects when run (instead of the 'orrible flat ones that PHP spits out) and I've finally cracked the logic of it (ie. it's working!).
I'm running a test query on it at the moment - returning 174 results (the final array is 100) - there's 2 left joins and a natural left join. The query looks like this:
To run this query and build the nice big object 40 times, it's taking 1.75 seconds (on localhost). A query with 1 left join takes about 0.4 seconds.
In your opinion, is this an acceptable amount of time to allow this to run? Obviously, I won't be loading 174 rows on a client-facing page, it'll probably be more like 50 at the most - and it won't be 40 queries per page - I'd say it'd be more like 10-15 at the very upper limit.
What do you reckon?
Thanks
I'm running a test query on it at the moment - returning 174 results (the final array is 100) - there's 2 left joins and a natural left join. The query looks like this:
Code:
SELECT Blog.BlogId AS Blog___BlogId, Blog.Posted AS Blog___Posted, Blog.Title AS Blog___Title, Blog.Entry AS Blog___Entry,
BlogComment.CommentId AS BlogComment___CommentId, BlogComment.Username AS BlogComment___Username, BlogComment.BlogId AS
BlogComment___BlogId, BlogComment.Date AS BlogComment___Date, BlogComment.Comment AS BlogComment___Comment,
BlogComment.Authd AS BlogComment___Authd, Member.Username AS Member___Username, Member.Digest AS Member___Digest,
Member.Salt AS Member___Salt, Member.URL AS Member___URL, Member.Email AS Member___Email, Member.Authd AS Member___Authd,
BlogTag.BlogId AS BlogTag___BlogId, BlogTag.Tag AS BlogTag___Tag FROM Blog NATURAL JOIN BlogTag NATURAL LEFT JOIN BlogComment
LEFT JOIN Member USING(Username) ORDER BY Blog.Posted DESC,Blog.BlogId ASC,BlogTag.BlogId ASC,BlogComment.CommentId
ASC,Member.Username ASC
To run this query and build the nice big object 40 times, it's taking 1.75 seconds (on localhost). A query with 1 left join takes about 0.4 seconds.
In your opinion, is this an acceptable amount of time to allow this to run? Obviously, I won't be loading 174 rows on a client-facing page, it'll probably be more like 50 at the most - and it won't be 40 queries per page - I'd say it'd be more like 10-15 at the very upper limit.
What do you reckon?
Thanks
