Received: from maia.hub.org (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id E1A53632F59 for ; Fri, 11 Dec 2009 18:13:39 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 48609-06 for ; Fri, 11 Dec 2009 22:13:32 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from EXHUB018-3.exch018.msoutlookonline.net (exhub018-3.exch018.msoutlookonline.net [64.78.17.18]) by mail.postgresql.org (Postfix) with ESMTP id 6886C6329F3 for ; Fri, 11 Dec 2009 18:13:32 -0400 (AST) Received: from EXVMBX018-1.exch018.msoutlookonline.net ([64.78.17.47]) by EXHUB018-3.exch018.msoutlookonline.net ([64.78.17.18]) with mapi; Fri, 11 Dec 2009 14:13:30 -0800 From: Scott Carey To: Scott Marlowe , Nikolas Everett CC: "jd@commandprompt.com" , Andres Freund , "pgsql-performance@postgresql.org" , Michael Clemmons Date: Fri, 11 Dec 2009 14:12:45 -0800 Subject: Re: 8.4.1 ubuntu karmic slow createdb Thread-Topic: [PERFORM] 8.4.1 ubuntu karmic slow createdb Thread-Index: Acp6rRSgY1s+l1aERIm0ov7X8f/t3AAAfv5v Message-ID: In-Reply-To: Accept-Language: en-US Content-Language: en X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-2.599 tagged_above=-10 required=5 tests=BAYES_00=-2.599 X-Spam-Level: X-Archive-Number: 200912/158 X-Sequence-Number: 36772 On 12/11/09 1:57 PM, "Scott Marlowe" wrote: >=20 > This is my big issue. dropping / creating databases for unit tests is > overkill. Running any DDL at all for a unit test seems wrong to me > too. Insert a row if you need it, MAYBE. Unit tests should work with > a test database that HAS the structure and database already in place. >=20 > What happens if your unit tests get lose in production and drop a > database, or a table. Not good. >=20 Production should not have a db with the same username/pw combination as de= v boxes and unit tests . . . Unfortunately, unit-like (often more than a 'unit') tests can't always rely on a test db being already set up. If one leaves any cruft around, it migh= t break later tests later on non-deterministically. Automated tests that insert data are absolutely required somewhere if the application inserts data. The best way to do this in postgres is to create a template database from scratch with whatever DDL is needed at the start of the run, and then creat= e and drop db's as copies of that template per test or test suite. So no, its not overkill at all IMO. I do wish to avoid it, and ideally all tests clean up after themselves, but in practice this does not happen and results in hard to track down issues where test X fails because of somethin= g that any one of tests A to W did (all of which pass), often wasting time of the most valuable developers -- those who know the majority of the system well enough to track down such issues across the whole system. One thing to consider, is putting this temp database in a RAMFS, or ramdisk since postgres does a lot of file creates and fsyncs when cloning a db from a template. For almost all such test db's the actual data is small, but th= e # of tables is large. > -- > Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org= ) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-performance >=20