Re: Problem reloading regression database

Поиск
Список
Период
Сортировка
От Brent Verner
Тема Re: Problem reloading regression database
Дата
Msg-id 20020115054438.GA10537@rcfile.org
обсуждение исходный текст
Ответ на Re: Problem reloading regression database  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: Problem reloading regression database
Re: Problem reloading regression database
Список pgsql-hackers
[2002-01-14 21:52] Tom Lane said:
| Brent Verner <brent@rcfile.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


В списке pgsql-hackers по дате отправления:

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: About pg_upgrade
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: About pg_upgrade