Received: from makus.postgresql.org ([98.129.198.125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T7ROc-0006ZA-PJ for pgsql-performance@postgresql.org; Fri, 31 Aug 2012 13:36:26 +0000 Received: from mail-lb0-f174.google.com ([209.85.217.174]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T7ROa-0003DD-RM for pgsql-performance@postgresql.org; Fri, 31 Aug 2012 13:36:25 +0000 Received: by lbbgj3 with SMTP id gj3so1218038lbb.19 for ; Fri, 31 Aug 2012 06:36:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:reply-to:user-agent:mime-version:to:cc :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=GQRdvYUh7psbBPO+KoFe0bSKfc1RHDX9etU2cqu1BAk=; b=RczVHN2cfmqcPHvLIj4ZQ0zxeDEDAOlWp3kfTB3wdAKMcd1uGzyKXt0Zjqy6E68xys cw+OlsHMcWpoA3TSiByzuciv8IP0gizgQMREyK0d2XEa7NASsD40sdYfWcAZDkmLPN6x n0iaIi5GSvzgMDgB5eZpnb40X7VKo9lwKbNgdFPSHqzWmaQLfdSpmWwbro1VbuxqWmO2 6FC33m0V7NXTAyQwnYCypG7wJioyZU56eVFChRi0GCXhLLdW0q/74mZ0dBFc0XFkgWD8 3bvFkH/6GTuzyu7KTKJRbT5gECB1af64S+D0FBOEVdFHohHZHN42qQFtsfW5p6/QlI2r cmAA== Received: by 10.152.103.244 with SMTP id fz20mr6605675lab.54.1346420181325; Fri, 31 Aug 2012 06:36:21 -0700 (PDT) Received: from [192.168.1.101] (dsl-hkibrasgw2-fedadf00-197.dhcp.inet.fi. [80.223.218.197]) by mx.google.com with ESMTPS id o3sm1282838lbk.6.2012.08.31.06.36.18 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 31 Aug 2012 06:36:20 -0700 (PDT) Message-ID: <5040BDD0.9070207@iki.fi> Date: Fri, 31 Aug 2012 16:36:16 +0300 From: Heikki Linnakangas Reply-To: hlinnaka@iki.fi User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:10.0.6esrpre) Gecko/20120817 Icedove/10.0.6 MIME-Version: 1.0 To: John Nash CC: pgsql-performance@postgresql.org Subject: Re: exponential performance decrease in ISD transaction References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -2.6 (--) X-Archive-Number: 201208/201 X-Sequence-Number: 47739 On 31.08.2012 15:27, John Nash wrote: > Program 1: dbtransfromfile: this program creates a simple table > consisting of a one int column table. After the creation, the program > inserts 1000 tuples in the table, which are never deleted, after that > the program reads a transaction pattern from a given file and executes > it a number of times determined when the program is launched. > > The transaction we are launching is (INSERT/SELECT/DELETE) the following: > > insert into T_TEST values (1);select * from T_TEST where > c1=1000;delete from T_TEST where c1=1;commit; Sounds like the table keeps growing when rows are inserted and subsequently deleted. PostgreSQL doesn't immediately remove deleted tuples from the underlying file, but simply marks them as deleted. The rows are not physically removed until autovacuum kicks in and cleans it up, or the table is vacuumed manually. I'd suggest creating an index on t_test(c1), if there isn't one already. It's not helpful when the table is small, but when the table is bloated with all the dead tuples from the deletions, it should help to keep the access fast despite the bloat. - Heikki