Re: Optimise PostgreSQL for fast testing

From: Jack Christensen <jackc(at)hylesanderson(dot)edu>
To: pgsql-general(at)postgresql(dot)org
Subject: Re: Optimise PostgreSQL for fast testing
Date: 2012-02-23 16:06:24
Message-ID: 4F466400.2020809@hylesanderson.edu
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 2/23/2012 9:22 AM, Simon Riggs wrote:
> On Thu, Feb 23, 2012 at 5:13 AM, Dmytrii Nagirniak<dnagir(at)gmail(dot)com> wrote:
>
>> I wonder if you can suggest me how to speed-up PG when running specs.
>> I asked it at SO here:
>>
>> http://stackoverflow.com/questions/9407442/optimise-postgresql-for-fast-testing
>>
>> But briefly. PG specs are>2x slower than SQLite.
>> I want it to be on par (don't care about reliability or anything, just need
>> fast specs).
>>
>> Would appreciate some suggestions.
> You really need to explain why this matters...
>
> You mention a "typical Ruby on Rails app" and then discuss SQLite.
> Well, typical web apps have more than 1 user, so fairly obviously
> using SQLite isn't appropriate. If SQLite isn't appropriate, why are
> you testing with it? How does a test run on a database you aren't
> using in production tell you anything about the success or otherwise
> of your program. It doesn't, so saying it runs quicker is irrelevant,
> surely?
>
> Perhaps just run half the test, that would make it twice as quick and
> still just as valid.
>
> If Postgres tests run in ~1 minute, what benefit have you gained from
> saving 30 seconds? How often are you running tests?
>
> So please explain a little more.
>
As another Rails developer using PostgreSQL I think I can explain the
use case. In standard Rails usage, the ORM handles all SQL query
generation and thus the application is database agnostic. It is typical
to use SQLite in development and testing and MySQL or PostgreSQL in
production. However, if any PostgreSQL specific functionality is used
then obviously PostgreSQL must also be used in development and testing.

Another common practice is test-driven development. So the test suite
for the application may run scores or hundreds of times per day per
developer. So the speed of the test suite is of vital importance to
developers. A 30 second difference 100's of times per day really can add
up.

--
Jack Christensen
jackc(at)hylesanderson(dot)edu

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2012-02-23 16:41:44 Re: How to enable thread safety on postgresql 8.3.6
Previous Message Wim Bertels 2012-02-23 15:46:29 Re: psql latex and newlines