SELECT t1...."> SELECT t1....">
 
Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Feb 2001
Posts: 2,268
Junior Member
Junior Member
Offline
Joined: Feb 2001
Posts: 2,268
Here's my question: Does the order that you chose for your databs query make a difference? Example: I have this query:

Code
 $query = "<br />SELECT t1.B_Number,t1.B_Posted,t1.B_Last_Post,t1.B_Subject,t1.B_Body,t1.B_Main,t1.B_Replies,t1.B_Counter,t2.U_Username,t2.U_Picture,t2.U_PicWidth,t2.U_PicHeight<br />FROM  {$config['tbprefix']}Posts AS t1,<br />{$config['tbprefix']}Users AS t2<br />WHERE t1.B_Number = t1.B_Main<br />AND   t1.B_Board  = '$Newsboard_q'<br />AND   t1.B_Approved = 'yes'<br />AND   t1.B_PosterId = t2.U_Number<br />AND t1.B_Posted >= '$time'<br />ORDER BY t1.B_Posted DESC<br />"; 


The first thing I'm looking for is the first post in a thread, but the second line drills down to the posts from a single board. Would it make more sense / be fasted if the board was listed first, then go for the first post. Or does MySQL look at the query as a whole so that the order of the query doesn't matter?...

Sponsored Links
Entire Thread
Subject Posted By Posted
Does the order of a query make a difference? Dalantech 01/29/2004 12:44 PM
Re: Does the order of a query make a difference? Rick 01/29/2004 6:10 PM
Re: Does the order of a query make a difference? Dalantech 01/29/2004 10:39 PM

Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Zarzal
Zarzal
Berlin, Germany
Posts: 808
Joined: July 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240430)