Hi, I merged the two tables into a single one, changed the mapping but the query still needs more than 10 seconds :/ That's how EXPLAIN looks like now: http://paste.pocoo.org/show/63542/ I think the problem is this one: | 2 | DERIVED | forum_post | ALL | forum_post_topic_id | forum_post_topic_id | 4 | NULL | 198398 | Using filesort | do you have any idea, why mysql is using filesort for this and how I can get mysql not to search through 198398 rows? These are the indexes of forum_post: http://paste.pocoo.org/show/63543/
Benjamin Wiegand On 5 Jun., 20:33, Michael Bayer <[EMAIL PROTECTED]> wrote: > for starters I'd combine "post_table" and "post_text_table" into > one....not much is accomplished there by having two tables. Also make > sure forum_post.topic_id is indexed. > > On Jun 5, 2008, at 1:37 PM, beewee wrote: > > > > > Hi, > > > we're writing a bulleting board using sqlalchemy at the moment, but we > > have the problem, that the database query for viewing a topic is quite > > slow for big topics. > > These are the relevant table definitions and mappings: > >http://paste.pocoo.org/show/62703/ > > This is the query that is slow:http://paste.pocoo.org/show/62706/ > > This is what EXPLAIN says:http://paste.pocoo.org/show/62708/ > > Executing this query needs up to 25 seconds on our test server that's > > just idling. On our productive servers (which aren't idling, of > > course) phpbb is able to execute an adequate query much faster. May > > you can help us speeding up this query? I don't know what to improve, > > since all parts of the query already use a key (except the derived > > one), but unfortunately I have a quite small knowledge of improving > > database queries. > > > Thank you very much, > > > Benjamin Wiegand --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---