Register Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools
  #1  
Old 25 Jun 2011, 14:30
ThorstenA's Avatar
ThorstenA ThorstenA is offline
 
Join Date: Nov 2004
slow query for thread.forumid. help me optimize

This query is slow (0.15 seconds) despite of having indexes everywhere.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

These both queries are fast when removing either forumid=1 or the attachment table. Why is that? How can I rewrite my #1 query to make it faster?

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.

--------------- Added 25 Jun 2011 at 14:35 ---------------

Found the solution. This is extremely fast. The forumid restriction in the inner join thread seems to be very good.

Block Disabled:      (Update License Status)  
Suspended or Unlicensed Members Cannot View Code.


Last edited by ThorstenA; 25 Jun 2011 at 14:46.
Reply With Quote
  #2  
Old 27 Jun 2011, 06:17
Pandemikk Pandemikk is offline
 
Join Date: Jul 2009
Real name: Jon
Glad you found the solution. Before you were selecting all threads and then applying the forumid restriction!

Happy coding.

p.s. you don't need those parenthesis for the on clause, in case you didn't know.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


New To Site? Need Help?

All times are GMT. The time now is 09:07.

Layout Options | Width: Wide Color: