Viewing 13 replies - 1 through 13 (of 13 total)
  • Can you expand on this at all ?

    Thread Starter Anonymous

    Well sorry pressed enter where i shouldn’t.
    For the record, i don’t know is this is a 1.2.1 version problem but whe i go https://www.janmarijnissen.nl/weblog/index.php?p=617#comments look there. on 643 replys the log gives 643 querys, and takes 13 sec of the time.
    I cannot get to the idea that thats meant to be like that ?

    From what little I know about sql, 1 query gets 1 piece of information.
    As you have 643 comments, that would seem to be 643 queries, with the rest being for other page information. So I’d say it was right. But then I could be wrong….
    There is a ‘staticize’ plugin which may be of use ? (And I can’t find the link right now)
    That was a popular post you made!

    Thread Starter Anonymous

    You can’t be series. wordpress performs 1 query for every comment? seeing how long that page takes to generate i wouldn’t be surprised if it was actually doing that.
    depending on how the queries are structured 1 query could get 1 piece of information (1 row) but i would have expected a single query would return all the comments for that post, and now send a query to the server for each comment.
    That’s very very very inefficient… if that’s how they’re doing it. would be good to see what a dev says about that.

    joe_doufu

    (@joe_doufu)

    Try removing functions from the comments PHP include. I’m not on my PC now so I can’t look at the code, but for instance try dropping the “date” or “time” request or the link to the individual comment. Just try removing these things one at a time until you see the requests reduced.
    If that doesn’t do it, then we’ve got to look more seriously at the PHP.

    joe_doufu

    (@joe_doufu)

    I just checked, and my WP blog does the same thing – one query for every comment. However, I don’t have any posts with more than one comment! It’s a new blog.

    TechGnome

    (@techgnome)

    I jsut looked at the comments code (WP1.2) and there’s only one query to get the comments.
    – “SELECT * FROM $tablecomments WHERE comment_post_ID = ‘$id’ AND comment_approved = ‘1’ ORDER BY comment_date”
    That gets all comments for the given $id in order of the comment date.
    That list is them looped through to provide the output. What I haven’t done yet, is to look through the code the defines the comments data to see if there is an additional query happening.
    But as for the comments themselves, it’s one query with 643 results.
    TG

    joe_doufu

    (@joe_doufu)

    maybe for each comment it checks the spam words list once?

    TechGnome

    (@techgnome)

    That should be done on the way in, not the way out. I’m wondering if there’s a plugin that is doing a query for each post – since the plugin gets called once for each post, that would seem to make sense. But I don’t know for sure.
    Tg

    joe_doufu

    (@joe_doufu)

    i don’t have any plugins like this, and i also seem to have extra queries. maybe the query is some kind of a JOIN. what do you think?

    TechGnome

    (@techgnome)

    The query I posted above is the query used. No joins, nothing. Even if there were joins, it would still be part of the above query and not something separate.
    Like I said, I haven’t had the chance to look through the code any further than the cursory check to see what queries were being run. I don’t want to come across as being arrogant or anything, but trust me, I know what I’m talking about. I’m not a WP dev nor a PHP expert by any means but I am a professional developer – I know what I need to look for and where, I simply don’t have access to the files at the moment.
    Something that occurred to me, even if you don’t have any plugins turned on, there may still be a hit to the DB for each comment when the comment plug in hook is fired as it’s looking to see if there are any plugins to run.
    I don’t know, I could be wrong about that.
    TG

    joe_doufu

    (@joe_doufu)

    [Moderated – abuse removed]
    Read the Sticky.

    TechGnome

    (@techgnome)

    Well. I have to admit, I’ve been called a number of things over the years, but I think that epitaph is a first for me. You asked what I thought, and I gave my opinion. There’s no need to resort to that kind of childish name-calling. Leave that to the professionals (read politicians.)
    I gave the query that is used for pulling the comments. There’s no join in there. That’s it. End of story. Also a join would NOT impact the number of quries, but the number of rows returned by the query.
    Since it is now plainly obvious you don’t need or want my help, I’ll leave this all to you.
    TG

Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘way to many querys.’ is closed to new replies.