Re: Speed of locating tables? - Mailing list pgsql-general

From Tom Lane
Subject Re: Speed of locating tables?
Date
Msg-id 2447.959358857@sss.pgh.pa.us
Whole thread Raw
In response to Re: Speed of locating tables?  (Steve Wampler <swampler@noao.edu>)
List pgsql-general
Steve Wampler <swampler@noao.edu> writes:
> Hmmm, but there's now only one table (with around 2 million rows)
> instead of 100,000 (each with around 20 rows) right?  (I'm confused by
> the "Every table gets...").  I read what you've written as saying "add
> the configuration set ID to each attribute (so now it's an ID, name,
> value triple instead of a pair), storing all attributes for all sets
> in a single table

Right so far.

> and then, when given an ID, search the table,
> collect the matching rows into a temporary table and reference the
> attributes from that temporary table" - is that correct?  [I don't
> need fast update of the attributes, just fast read access while the
> sun is shining.]

There's no particular reason to make a temp table.  As long as you have
an index on the ID column, queries like

    SELECT * FROM configurations WHERE id = 'foo';

will be fast.  This is what DBMSes live to do.

> I imagine I can pull "old" configuration sets from the large table
> (every night, perhaps) and archive them into some other table(s) to
> keep the size of the active table smaller.

If you insist, but it's unlikely to be worth the trouble.

            regards, tom lane

pgsql-general by date:

Previous
From: "Bryan White"
Date:
Subject: Re: PG 7.0 is 2.5 times slower running a big report
Next
From: Barry Lind
Date:
Subject: Re: Speed of locating tables?