View Full Version : Order By... in a Join
Guest.Visitor
05-04-2006, 09:34 AM
What occurs to me: 1. Check the Query Optimizer messages - maybe it'll suggest an index that would work. 2. Create the resultset as a table, then sort the table. CREATE TABLE sometable AS (your sql statement) WITH DATA SELECT * FROM sometable ORDER BY somefield
Guest.Visitor
05-08-2006, 02:12 PM
Hello, I've created an SQL query that joins a few files. Everything works fine but I would like to order the resultset by a field that is one of the joined tables. When I add the "order by" clause at the end of the query, performance takes a severe hit. Basically, what I would like SQL to do is order the resultset after the resultset is created. Maybe that's not possible, but does anyone have ideas on how to get this to work?
TheQuigs
05-08-2006, 02:12 PM
I don't have a lot of the details handy, but this can be a great help when trying to diagnose SQL performance. If you use the explain function, it will show you graphically each step used to process your SQL statement. you can get even more detail by clicking on a specific step or sometimes even just by hovering your mouse near it.
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.