Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XjILK-0006zX-F1 for pgsql-general@arkaria.postgresql.org; Wed, 29 Oct 2014 01:46:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XjILJ-0005Vu-Na for pgsql-general@arkaria.postgresql.org; Wed, 29 Oct 2014 01:46:33 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XjILI-0005TM-AG for pgsql-general@postgresql.org; Wed, 29 Oct 2014 01:46:32 +0000 Received: from sam.nabble.com ([216.139.236.26]) by makus.postgresql.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.80) (envelope-from ) id 1XjILF-0001sf-9n for pgsql-general@postgresql.org; Wed, 29 Oct 2014 01:46:30 +0000 Received: from [192.168.236.26] (helo=sam.nabble.com) by sam.nabble.com with esmtp (Exim 4.72) (envelope-from ) id 1XjILE-0005Zf-BO for pgsql-general@postgresql.org; Tue, 28 Oct 2014 18:46:28 -0700 Date: Tue, 28 Oct 2014 18:46:28 -0700 (PDT) From: David G Johnston To: pgsql-general@postgresql.org Message-ID: <1414547188335-5824744.post@n5.nabble.com> In-Reply-To: References: Subject: Re: Query optimization MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Pg-Spam-Score: 0.8 (/) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-general Precedence: bulk Sender: pgsql-general-owner@postgresql.org Jorge Ar=C3=A9valo-2 wrote > So, I first generate a common table records_to_insert, using data from > table1 and table2, and then call a function fill_table3_function, in order > to insert the values into table3 (I do more things apart from insert, > that's reason to call a function instead of just raising an insert query). > There are indexes created on all the columns that need them. I would suggest you figure out how to do what you need without pushing the insert into the function. > So, is there anything obviously wrong with my query? Any changes to make > it > faster? You shouldn't expect much useful help when the important part of your query is not provided. Creating arrays and hstores is expensive but whether that is the biggest factor is impossible to tell. David J. -- View this message in context: http://postgresql.1045698.n5.nabble.com/Query= -optimization-tp5824739p5824744.html Sent from the PostgreSQL - general mailing list archive at Nabble.com. --=20 Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general