Received: from localhost (unknown [200.46.204.184]) by developer.postgresql.org (Postfix) with ESMTP id 1EB392E0039 for ; Tue, 6 May 2008 13:41:45 -0300 (ADT) Received: from developer.postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 10210-09 for ; Tue, 6 May 2008 13:41:40 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from qb-out-0506.google.com (qb-out-0506.google.com [72.14.204.225]) by developer.postgresql.org (Postfix) with ESMTP id AFF342E002D for ; Tue, 6 May 2008 13:41:41 -0300 (ADT) Received: by qb-out-0506.google.com with SMTP id a39so1110593qbd.17 for ; Tue, 06 May 2008 09:41:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=ygHYpJ+orefYzY9AR1MHn3fxarfKUsr71FoNJbXMQ80=; b=SCWznJ9GwvO1zqolX1AJtOz9SmTrKUZm0a0iJ9hb6m58/um2yP8SR9saGnr32bx8x37Y/Bgsd5Im/C2eQ1Qy47/V9d53IYaKpovjF2s3H41PLnQV2UnAWRxDaEn4wgOIgjoIeFOqF+AxzoTd4D/7s19O6yNwlTnDWdObBMGb0nU= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:cc:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=XDnj9weWiRhx0xhFPx1wskwpPkdTo+rHPCvdilc5vVhH4wZK5UhPTLx8eEA7ub7ZluPV4jD9BdoIw3QuqTUWGcnC4I4bdqDsTtuvTucEWvcCKwp2OUp32qI+SueyRrSMUlHBjfdmmn2nMDxMB26OjLU7mteLszCtSaWOjf/qSVE= Received: by 10.115.60.1 with SMTP id n1mr927828wak.181.1210092100327; Tue, 06 May 2008 09:41:40 -0700 (PDT) Received: by 10.114.137.7 with HTTP; Tue, 6 May 2008 09:41:40 -0700 (PDT) Message-ID: Date: Tue, 6 May 2008 10:41:40 -0600 From: "Scott Marlowe" To: Justin Subject: Re: What constitutes a complex query Cc: pgsql-performance@postgresql.org In-Reply-To: <48207D26.7050201@emproshunts.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <48207D26.7050201@emproshunts.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200805/86 X-Sequence-Number: 30054 On Tue, May 6, 2008 at 9:45 AM, Justin wrote: > This falls under the stupid question and i'm just curious what other people > think what makes a query complex? Well, as mentioned, there's two kinds. some that look big and ugly are actually just shovelling data with no fancy interactions between sets. Some reporting queries are like this. I've made simple reporting queries that took up many pages that were really simple in nature and fast on even older pgsql versions (7.2-7.4) I'd say that the use of correlated subqueries qualifies a query as complicated. Joining on non-usual pk-fk stuff. the more you're mashing one set of data against another, and the odder the way you have to do it, the more complex the query becomes.