Re: where in (select array)

From: Richard Huxton <dev(at)archonet(dot)com>
To: Marcus Engene <mengpg2(at)engene(dot)se>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: where in (select array)
Date: 2008-11-21 08:46:34
Message-ID: 4926756A.5060709@archonet.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Marcus Engene wrote:
> So with memcached I care less about saving a few mS in select latency
> and more about postponing other approaching problems like having the
> dbdump manageble. Right now it's a 100MB gzipped dump, which is very
> manageable, so where it's possible I'd like to keep the data compact.

If you remove the duplication you reduce the amount it will compress by.
Oh - and you're not gzipping the dump yourself are you? Use the "-Fc"
format to dump with and it'll already be compressed.

> I
> imagine it's cheaper disk & dump wise to do the array thing in this and
> some other similar usages, and therefore it would be nice to have a
> non-ugly usage pattern.

Don't imagine, test. And then factor in the cost of fiddling around with
arrays when you need to access individual values. And the cost of the
time you spent working on all this.

> Also, we're going to collect usage statistics to
> further optimize the behavior of the site, and I'm really worried about
> these millions of rows.

Either:
1. Collect usage stats, *then* optimise. Then collect more stats and
make sure what you did was useful.
2. Stop worrying, and knock off early. Go have a couple of drinks with
works colleagues and unwind - it's the weekend!
3. Flip a coin and decide how to proceed based on that.

Now, #1 is the most effective but also the most effort and cost. Numbers
2,3 are about equal but both beat spending time optimising something you
haven't measured yet.

--
Richard Huxton
Archonet Ltd

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Pavan Deolasee 2008-11-21 09:20:58 Re: transaction isolation level in plpgsql function
Previous Message Richard Huxton 2008-11-21 07:56:51 Re: Serial - last value