Your Opinions please (page load/run times)

Sic

Sic

Soldato
Joined
9 Nov 2004
Posts
15,365
Location
SO16
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:

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 :)
 
if it is taking 1.75 seconds at the mo and you are getting 174 rows then logic might say that returning 50 rows would only take 0.5 seconds and this would be acceptable, but it is hard to tell without a working example.
 
You've also got to take into account the fact that this is running locally, and the potential number of concurrent requests. 1.75 seconds might be OK if there's only one request at a time but with 200 users requesting the same page at the same time, how does that affect performance?
 
Back
Top Bottom