Re: Problem reloading regression database

From: Brent Verner <brent(at)rcfile(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Problem reloading regression database
Date: 2002-01-15 05:44:38
Message-ID: 20020115054438.GA10537@rcfile.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

[2002-01-14 21:52] Tom Lane said:
| Brent Verner <brent(at)rcfile(dot)org> writes:
| > gotcha. No, I don't think anything inside that loop expects to
| > persist across iterations. The attribute_buf is static to the
| > file, and initialized in DoCopy.
|
| There is more to attribute_buf than meets the eye ;-)
|
| > What I ended up doing is switching to per-tuple-context prior to
| > the input loop, then switching back to the (saved) query-context
| > after exiting the loop. I followed ResetTupleExprContext back, and
| > it doesn't seem to do anything that would require a switch per loop.
| > Are there any problems this might cause that I'm not seeing with
| > my test case?
|
| I really don't feel comfortable with running heap_insert or the
| subsequent operations in a per-tuple context. Have you tried any
| test cases that involve triggers or indexes?

Yes, and I'm seeing no new problems (so far), but there is a problem
in the current copy.c. Running the following on unmodified 7.2b5
causes the backend to consume 17-18Mb of memory. Removing the
REFERENCES on yyy.b causes memory use to be normal.

bash$ cat copy.sql
DROP table yyy;
DROP SEQUENCE yyy_id_seq ;
DROP TABLE zzz;
DROP SEQUENCE zzz_id_seq ;
CREATE TABLE zzz (
id SERIAL,
a INT,
b TEXT NOT NULL DEFAULT 'test' PRIMARY KEY,
c INT NOT NULL DEFAULT 1
);
CREATE TABLE yyy (
id SERIAL,
a INT,
b TEXT NOT NULL DEFAULT 'test' REFERENCES zzz(b),
c INT NOT NULL DEFAULT 1
);
-- make sure there is a 'test' value in zzz.b
INSERT INTO zzz (a) VALUES (10);
COPY yyy FROM '/tmp/sometmpfilehuh'

bash$ for i in `seq 1 200000`; do echo "$i $i test $i" >> /tmp/sometmpfilehuh; done

bash$ head -1 /tmp/sometmpfilehuh; tail -1 /tmp/sometmpfilehuh
1 1 test 1
200000 200000 test 200000

bash$ ./psql < copy.sql

Any ideas? I'm looking around ExecBRInsertTriggers() to see what
might need to be freed around that call.

thanks.
brent

--
"Develop your talent, man, and leave the world something. Records are
really gifts from people. To think that an artist would love you enough
to share his music with anyone is a beautiful thing." -- Duane Allman

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Brent Verner 2002-01-15 05:56:52 Re: Problem reloading regression database
Previous Message Bruce Momjian 2002-01-15 05:38:08 Re: About pg_upgrade