Re: ShmemAlloc errors

From: Manfred Koizar <mkoi-pg(at)aon(dot)at>
To: Nick Burrett <nick(at)dsvr(dot)net>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-general(at)postgresql(dot)org
Subject: Re: ShmemAlloc errors
Date: 2003-10-17 16:57:24
Message-ID: 2g40pvc866bbd2ssq2baqd173f4u5u94pc@email.aon.at
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Fri, 17 Oct 2003 15:47:10 +0100, Nick Burrett <nick(at)dsvr(dot)net>
wrote:
>CREATE TABLE fiveminute ( server CHAR(32),
> stamp TIMESTAMP,
> bytesin BIGINT CHECK (bytesin >= 0),
> bytesout BIGINT CHECK (bytesout >= 0));
>
>CREATE UNIQUE INDEX fiveminute_idx ON fiveminute(server,stamp);

Making this

CREATE TABLE server (
id int NOT NULL PRIMARY KEY,
name text NOT NULL
);
CREATE TABLE fiveminute (
serverid int NOT NULL REFERENCES server,
stamp timestamp NOT NULL,
bytesin bigint CHECK (bytesin >= 0),
bytesout bigint CHECK (bytesout >= 0),
PRIMARY KEY (serverid, stamp)
);

should give you a much smaller index on fiveminute.

If you have to load lots of data initially, better create the tables
without primary and foreign keys, import data and then

ALTER TABLE server ADD PRIMARY KEY (id);
ALTER TABLE fiveminute ADD PRIMARY KEY (serverid, stamp);
ALTER TABLE fiveminute
ADD FOREIGN KEY (serverid) REFERENCES server;

Servus
Manfred

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message enio 2003-10-17 16:58:03 Difference between check and a small table
Previous Message Jan Wieck 2003-10-17 16:32:15 Re: Cygwin? or paid version from SRA?