Received: from localhost (unknown [200.46.204.184]) by developer.postgresql.org (Postfix) with ESMTP id D83F52E004E for ; Wed, 9 Apr 2008 20:33:51 -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 50900-04 for ; Wed, 9 Apr 2008 20:33:41 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.5 Received: from wa-out-1112.google.com (wa-out-1112.google.com [209.85.146.182]) by developer.postgresql.org (Postfix) with ESMTP id 23EC02E004F for ; Wed, 9 Apr 2008 20:33:48 -0300 (ADT) Received: by wa-out-1112.google.com with SMTP id m38so2692070waf.5 for ; Wed, 09 Apr 2008 16:33:47 -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=o7LkySMsHFNv2jJ6kt7MhSRoYaRngcG9BQR9QQV3L/M=; b=X3Sm34hfzcFLxV+9SS5NIlww+ebP/9D11hZA/1u0RNGC+lgDvlzasPQKE3v8gfmhlszUYZQWROHrW6+aEv1lIToVc+TMlvx0r0e4uHX6zDiadeiBSDaxYiZYwjduuun9BHhUpq9+L0dSyasRHYAdgh5QOh+i9DS+1n55B4dO3ds= 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=FHo2rb6XdfGHmVXz4HmDR9cGp53EYFb5TyhGXFgATAONOOxzWSIkyMTnpTSx4hbY82UbiuJFWlScqzIDkIId1Bl17qHYRQYiVjKpul0Ym8wM4PXEFbEBSL/GGNMSk8nuLO+v/YdnMmcWBLHY0/1Vsl27N/0eEGm9WYce+lAh/XU= Received: by 10.115.108.1 with SMTP id k1mr730228wam.198.1207784026941; Wed, 09 Apr 2008 16:33:46 -0700 (PDT) Received: by 10.114.181.19 with HTTP; Wed, 9 Apr 2008 16:33:46 -0700 (PDT) Message-ID: Date: Wed, 9 Apr 2008 19:33:46 -0400 From: "samantha mahindrakar" To: valgog Subject: Re: Performance with temporary table Cc: pgsql-performance@postgresql.org In-Reply-To: <16cbbce7-9775-4ee5-8eb1-fdf56b7b8a3c@x19g2000prg.googlegroups.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <16cbbce7-9775-4ee5-8eb1-fdf56b7b8a3c@x19g2000prg.googlegroups.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0 tagged_above=0 required=5 tests=none X-Spam-Level: X-Archive-Number: 200804/118 X-Sequence-Number: 29611 The partitions are used to separate the data according to months. I have run a query o find bad data from each such partition. The imputation algorithm that i use requires data from 10 previous weeks in order to impute the data. This historical data i store in a temporary table, the i query this data so that i can take a average of all the historical data. Before taking average some computations are performed. Since i need the historical data for every minute of data that i need to impute i have to store the data in some intermediate table. Hence the temporary table. Now i changed the code to use a permanent table that is truncated after one set of data is imputed. I hope this makes sense. Samantha On Wed, Apr 9, 2008 at 6:44 AM, valgog wrote: > On Apr 7, 8:27 pm, sam.mahindra...@gmail.com ("samantha mahindrakar") > wrote: > > > > Hi > > I have written a program that imputes(or rather corrects data) with in > > my database. > > Iam using a temporary table where in i put data from other partitoined > > table. I then query this table to get the desired data.But the thing > > is this temporary table has to be craeted for every record that i need > > to correct and there are thousands of such records that need to be > > corrected. > > So the program necessarily creates a temporary table evrytime it has > > to correct a record. However this table is dropeed after each record > > is corrected. > > The program works fine.....but it runs for a very long time....or it > > runs for days. > > Iam particularyly finding that it takes more time during this statement: > > > > NOTICE: theQuery in createtablevolumelaneshist CREATE TEMPORARY TABLE > > predictiontable(lane_id, measurement_start, speed,volume,occupancy) AS > > SELECT lane_id, measurement_start, speed,volume,occupancy > > FROM samantha.lane_data_I_495 WHERE > > lane_id IN (1317) AND > > measurement_start BETWEEN '2007-11-18 09:25:00' AND 2007-11-19 01:39:06' > > > > Iam not sure if i can use a cursor to replicate the functionality of > > the temp table. Is the performance bad because of the creation and > > deletion of the temp table? > > > > Thanks > > Samantha > > > > -- > > Sent via pgsql-performance mailing list (pgsql-performa...@postgresql.org) > > To make changes to your subscription:http://www.postgresql.org/mailpref/pgsql-performance > > And why do you copy data from the partition tables? Did you try to > manipulate data directly in the needed tables? Or you are aggregating > some of the data there? How the partitioning is actually designed? Do > you use table inheritance? > > -- Valentine > > -- > Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-performance >