Douglas Brown wrote: > I was wondering if this is true or not, can someone answer this? Say I have a > table with 60,000 records in it, and I have a query where I want the data with > an ID of 4000. I heard sql searches like so > > 1 - 60000 > 2 - 59999 > 3 - 59998 > > but if you have an index, it does it like > 1 > 2 > 3 > 4 > until it gets to the correct ID
With no index you are probably a bit right. It will do a full tablescan, but it will read them in the order they are on the disk (which might be completely random). If there is an index, the database will probably use the index to determine the right record. After the index has hit the database will know the location of the actual record on the disk and read just that record from the disk. All of this is quite database dependent, so you should check your database docs for more details. Jochem ______________________________________________________________________ Structure your ColdFusion code with Fusebox. Get the official book at http://www.fusionauthority.com/bkinfo.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/[email protected]/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

