Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YvSbK-0006hM-Pz for pgsql-admin@arkaria.postgresql.org; Thu, 21 May 2015 15:41:38 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YvSbK-0003eN-AR for pgsql-admin@arkaria.postgresql.org; Thu, 21 May 2015 15:41:38 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YvSbI-0003ba-Eq for pgsql-admin@postgresql.org; Thu, 21 May 2015 15:41:36 +0000 Received: from mailout.easymail.ca ([64.68.201.169]) by makus.postgresql.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1YvSbD-0008NA-Ku for pgsql-admin@postgresql.org; Thu, 21 May 2015 15:41:35 +0000 Received: from localhost (localhost [127.0.0.1]) by mailout.easymail.ca (Postfix) with ESMTP id A6A28E247; Thu, 21 May 2015 11:41:30 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at mailout.easymail.ca X-Spam-Flag: NO X-Spam-Score: -3.891 X-Spam-Level: X-Spam-Status: No, score=-3.891 required=5 tests=[ALL_TRUSTED=-1.8, AWL=-0.184, BAYES_00=-2.599, DNS_FROM_AHBL_RHSBL=0.692] Received: from mailout.easymail.ca ([127.0.0.1]) by localhost (easymail-mailout.easydns.vpn [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zdSE9I7qpt9N; Thu, 21 May 2015 11:41:30 -0400 (EDT) Received: from [192.168.2.16] (unknown [8.39.228.5]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mailout.easymail.ca (Postfix) with ESMTPSA id 1A3EEE035; Thu, 21 May 2015 11:41:30 -0400 (EDT) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2098\)) Subject: Re: Read performance on Large Table From: Scott Ribe In-Reply-To: Date: Thu, 21 May 2015 09:41:28 -0600 Cc: "pgsql-admin@postgresql.org" Content-Transfer-Encoding: quoted-printable Message-Id: <1295589F-361A-4C3E-BA25-3A4F34C3CAB2@elevated-dev.com> References: <580E17C5-363E-4D24-B381-80A1F4C83C81@elevated-dev.com> To: Scott Marlowe X-Mailer: Apple Mail (2.2098) X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-admin Precedence: bulk Sender: pgsql-admin-owner@postgresql.org On May 21, 2015, at 9:21 AM, Scott Marlowe wrote: >=20 > I use an interesting method to setup partitioning. I setup my > triggers, then insert the data in chunks from the master table to > itself. >=20 > insert into master_table select * from only master_table limit 10000; >=20 > and run that over and over. The data is all in the same "table" to the > application. But it's slowly moving to the partitions without > interruption. Ah, good idea=E2=80=94I=E2=80=99ll have to remember that. In my case the table is write-mostly, read-rarely, and update-never, so ins= ert into partition select * from master where=E2=80=A6 with millions of row= s at a time was not a problem. The one thing I did differently from the documentation, is write a pgSQL pr= ocedure to create a partition for a particular date range and the function = and trigger, where the trigger function checks the date against the current= =E2=80=9Chead=E2=80=9D partition, and if the date is newer, calls the func= tion which creates the partition and replaces the trigger function. I hate = having to remember those things which only have to be done once a year ;-) And yes, that particular implementation depends on the fact that the criter= ia on which I=E2=80=99m partitioning increases monotonically. I expect it w= ould create a performance nightmare if I tried to insert old data into the = master table while the application was actively inserting new data. The sam= e basic technique can be adapted to other situations, but the trigger funct= ion is slightly more complicated, and the function to create the trigger fu= nction would be kind of ugly and hard to follow. --=20 Scott Ribe scott_ribe@elevated-dev.com http://www.elevated-dev.com/ https://www.linkedin.com/in/scottribe/ (303) 722-0567 voice --=20 Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-admin