Re: Update takes longer than expected

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andy Chambers <achambers(at)mcna(dot)net>
Cc: pgsql <pgsql-general(at)postgresql(dot)org>, IT Dev Department <itdevteam(at)mcna(dot)net>
Subject: Re: Update takes longer than expected
Date: 2012-01-09 21:30:14
Message-ID: 3947.1326144614@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Andy Chambers <achambers(at)mcna(dot)net> writes:
> I have an update that takes longer than expected and wondered if
> there's an easy way to make it go faster.

> It's pretty simple:-

> create table session (
> id serial primary key,
> data text);

> update session
> set data = 'ipsum lorem...'
> where id = 5;

> The "ipsum lorem.." stuff is an encrypted session variable from a
> rails app that does tend to get quite large

> select avg(length(data)) from session
> => 31275

> We're trying to migrate the app from mysql to pg and this is one of
> the performance bottle-necks. Unfortunately it slows down every
> request by about 5 seconds.

5 seconds!? I tried this example (with 31K of random data in the
literal) and got timings in the 10-to-15-millisecond range. And that's
with a debug build on an old, slow machine. There's something
drastically wrong with your setup, but there's not enough information
here to guess what.

regards, tom lane

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message John R Pierce 2012-01-09 21:31:56 Re: Update takes longer than expected
Previous Message Bill Moran 2012-01-09 21:26:21 Re: Update takes longer than expected