Re: where in (select array) - Mailing list pgsql-general

From Richard Huxton
Subject Re: where in (select array)
Date
Msg-id 4926756A.5060709@archonet.com
Whole thread Raw
In response to Re: where in (select array)  (Marcus Engene <mengpg2@engene.se>)
Responses Re: where in (select array)  (Marcus Engene <mengpg2@engene.se>)
List 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

pgsql-general by date:

Previous
From: "Gregory Williamson"
Date:
Subject: Re: Postgres mail list traffic over time
Next
From: "Pavan Deolasee"
Date:
Subject: Re: transaction isolation level in plpgsql function