Re: What causes a temp file to be used?
Posted in 1996
Topics: SQL Development & Query Writing
Mark S. Winsor wrote: > > I have a select with a join to another table on the primary key, and > an order by of custnum, callnum in the primary table. The set explain shows > that a temporary file is created due to this order by, yet I have an index > of custnum, callnum on the table. Why would this use a temporary table? > I'm using 5.01 SE. The join will take preference, along with any filters. If you want it to use an index, create an index that begins with the columns in your order by, and ends with the columns in the joins. Hope that helps, -- Mark. +-------------------------------------------------------------------------+ |Mark D. Stock - The West Solutions Group http://www.west.co.za | | The Informix FAQ is at http://www.iiug.org | |mailto:marks@west.co.za +------------------------------------------------+ |Tel: +27 11 803 2151 |If it doesn't work... force it! | |Fax: +27 11 803 2189 |If it breaks... it needed replacing anyway! | |Cell: +27 83 250 2325 |Well, that's how I code anyway! | +------------------------+------------------------------------------------+