Path: utzoo!attcan!uunet!husc6!mailrus!purdue!decwrl!ucbvax!ucdavis!sunny!poage From: poage@sunny.UUCP (Tom Poage) Newsgroups: comp.databases Subject: Is order important in SQL? Keywords: SQL Unify performance join-query Message-ID: <344@sunny.UUCP> Date: 6 Nov 88 07:05:21 GMT Distribution: na Organization: UCDMC Clinical Engineering, Sacto., CA Lines: 35 I'm writing a number of SQL scripts to perform queries involving multiple tables. My question is this: Is the order of entries in the "select", "from", and "where" clauses important in terms of performance? For example, select a,b,c,d,x,y,z,... from t1,t2,t3,... where t1.a = t2.a and t1.x = t2.x and z in <1,2,4,10> and ... / If table t1 is the primary table from which I retrieve references to entries in other tables, should it be located first in the "from" clause? Is order really important for table names? Further, can candidate selections can be eliminated "earlier" in the qualification process by placing certain comparisons before others in the where clause? I.e., reduce the number of comparisons before deciding on rejection based on my knowledge of the data distribution. I assume that order should, in a theoretical sense anyway, make no difference in this type of HLL. However, you never know.... Any hints, references, etc. are appreciated. Tom. -- Tom Poage, UCDMC Clinical Engineering, Sacto., CA ucdavis.ucdavis.edu!sunny!{poage,root,postmaster,news} ucbvax!ucdavis!sunny!{poage,root,postmaster,news}