Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id DFA21B5DBE1 for ; Sun, 11 Sep 2011 20:01:42 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 81353-10 for ; Sun, 11 Sep 2011 23:01:36 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from tamriel.snowman.net (tamriel.snowman.net [72.66.115.51]) by mail.postgresql.org (Postfix) with ESMTP id 9BDBBB5DBC5 for ; Sun, 11 Sep 2011 20:01:36 -0300 (ADT) Received: by tamriel.snowman.net (Postfix, from userid 1000) id 8896B22982; Sun, 11 Sep 2011 19:01:35 -0400 (EDT) Date: Sun, 11 Sep 2011 19:01:35 -0400 From: Stephen Frost To: Igor Chudov Cc: pgsql-performance@postgresql.org Subject: Re: Postgres for a "data warehouse", 5-10 TB Message-ID: <20110911230135.GN12765@tamriel.snowman.net> References: MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Fl9V9vFrQUs+59QW" Content-Disposition: inline In-Reply-To: X-Editor: Vim http://www.vim.org/ X-Info: http://www.snowman.net X-Operating-System: Linux/2.6.32-5-amd64 (x86_64) X-Uptime: 18:51:39 up 221 days, 7:21, 11 users, load average: 0.06, 0.03, 0.01 User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.403 tagged_above=-10 required=5 tests=BAYES_00=-1.9, LOTS_OF_MONEY=0.001, RP_MATCHES_RCVD=-0.504 X-Spam-Level: X-Archive-Number: 201109/129 X-Sequence-Number: 44905 --Fl9V9vFrQUs+59QW Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable * Igor Chudov (ichudov@gmail.com) wrote: > Right now I have a personal (one user) project to create a 5-10 > Terabyte data warehouse. The largest table will consume the most space > and will take, perhaps, 200,000,000 rows. I run data-warehouse databases on that order (current largest single instance is ~4TB running under 9.0.4). If the largest table is only 200M rows, PG should handle that quite well. Our data is partitioned by month and each month is about 200M records and simple queries can run in 15-20 minutes (with a single thread), with complex windowing queries (split up and run in parallel) finishing in a couple of hours.=20 > However, while an hour is fine, two weeks per query is NOT fine. What's really, really, really useful are two things: EXPLAIN, and this mailing list. :) Seriously, run EXPLAIN on your queries before you run them and see if how the query is going to be executed makes sense. Here's a real easy hint: if it says "External Sort" and has big numbers, come talk to us here- that's about one of the worst things you can possibly do. Of course, PG's going to avoid doing that, but you may have written a query (unintentionally) which forces PG to do a sort, or something else. > I have a server with about 18 TB of storage and 48 GB of RAM, and 12 > CPU cores. If you partition up your data and don't mind things running in different transactions, you can definitely get a speed boost with PG by running things in parallel. PG will handle that very well, in fact, if two queries are running against the same table, PG will actually combine them and only actually read the data from disk once. > I cannot shell out $47,000 per CPU for Oracle for this project. The above data warehouse was migrated from an Oracle-based system. :) > To be more specific, the batch queries that I would do, I hope, > would either use small JOINS of a small dataset to a large dataset, or > just SELECTS from one big table. Make sure that you set your 'work_mem' correctly- PG will use that to figure out if it can hash the small table (you want that to happen, trust me..). If you do end up having sorts, it'll also use the work_mem value to figure out how much memory to use for sorting. > So... Can Postgres support a 5-10 TB database with the use pattern > stated above? Yes, certainly. Thanks, Stephen --Fl9V9vFrQUs+59QW Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (GNU/Linux) iEYEARECAAYFAk5tPc8ACgkQrzgMPqB3kigtSgCffwEmi3AD6Ryff7qZyQYieyKQ jhoAoJDFC1snQmwCIBUjwlC6WVRyAOkn =LPtP -----END PGP SIGNATURE----- --Fl9V9vFrQUs+59QW--