Article View: borland.public.interbase.sql
Article #11188Re: Bulk inserts makes GDB grow
From: Bill Todd
Date: Tue, 10 Dec 2002 01:01
Date: Tue, 10 Dec 2002 01:01
93 lines
3356 bytes
3356 bytes
On Mon, 9 Dec 2002 23:00:10 +0100, "Dietrich v. Witzleben"
<info@witzleben-edv.de> wrote:
>Sorry,
>
>it's still growing. I'm using Interbase 6.016 / IBExpress
>
>Here is the exact code. The imported RAW-table is 1.488K small. With 10
>deletes/Inserts it is growing about 8MB.
>Also, it takes a long time (6 min) to close the GDB!!
>If I do a backup/restore it shrinks to it's original size.
>
>
> F_MAIN.TRANS.starttransaction;
>
> IBSQL1.Sql.Text := 'delete from stock;';
> IBSQL1.execQuery;
Look at my example again. You need to Commit and StartTransaction
here.
> IBQuery1.sql.clear;
> IBQuery1.sql.add('select * from stock');
> IBQuery1.open;
> IBQuery1.close;
>
> F_MAIN.TRANS.Commit;
>
> F_MAIN.TRANS.starttransaction;
>
> IBQuery1.sql.clear;
> IBQuery1.sql.add('select * from stock');
> IBQuery1.open;
> IBQuery1.close;
>
> IBSQL1.Sql.clear;
> IBSQL1.Sql.add('Insert into stock (');
> for x:=0 to IBQuery1.FieldDefs.count-2 do begin
> IBSQL1.Sql.add(IBQuery1.FieldDefs[x].name+',');
> end;
> IBSQL1.Sql.add(IBQuery1.FieldDefs[IBQuery1.FieldDefs.count-1].name+')
>values (');
> for x:=0 to IBQuery1.FieldDefs.count-2 do begin
> IBSQL1.Sql.add(':'+IBQuery1.FieldDefs[x].name+',');
> end;
>
>IBSQL1.Sql.add(':'+IBQuery1.FieldDefs[IBQuery1.FieldDefs.count-1].name+')');
>
> RawInput := TIBInputRawFile.Create;
> try
> RawInput.FileName := FileName;
> IBSQL1.BatchInput(RawInput);
> finally
> RawInput.Free;
> end;
>
> IBQuery1.sql.clear;
> IBQuery1.sql.add('select * from stock');
> IBQuery1.open;
> IBQuery1.close;
>
> F_MAIN.TRANS.Commit;
>
>
>
>"Bill Todd" <bill@notthis.dbginc.com> schrieb im Newsbeitrag
>news:pco9vu8ggnpbrg8jq30okset41k765j7nb@4ax.com...
>> delete * from stock
>> Commit
>> StartTransaction
>> select * from stock
>> insert into stock (id...) values (:id ...)
>>
>> Doing the SELECT will let IB garbage collect the deleted rows.
>>
>> On Mon, 4 Nov 2002 18:43:42 +0100, "Dietrich v. Witzleben"
>> <info@witzleben-edv.de> wrote:
>>
>> >delete * from stock
>> >insert into stock (id...) values (:id ...)
>>
>>
>> --
>> Bill (TeamB)
>> (TeamB cannot respond to questions received via email)
>
--
Bill (TeamB)
(TeamB cannot respond to questions received via email)
Technical Details
Message-ID:
<66favuo7kh7r0on6lc1r6hb8qikf6k8qaq@4ax.com>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<3df4d656$1@newsgroups.borland.com> <pco9vu8ggnpbrg8jq30okset41k765j7nb@4ax.com> <3df51274@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 114a0e,6aab62eb63eb5ff1 X-Google-Attributes: gid114a0e,public X-Google-ArrivalTime: 2002-12-09 17:09:23 PST From: Bill Todd <bill@notthis.dbginc.com> Newsgroups: borland.public.interbase.sql Subject: Re: Bulk inserts makes GDB grow Date: Mon, 09 Dec 2002 18:01:47 -0700 Message-ID: <66favuo7kh7r0on6lc1r6hb8qikf6k8qaq@4ax.com> References: <3df4d656$1@newsgroups.borland.com> <pco9vu8ggnpbrg8jq30okset41k765j7nb@4ax.com> <3df51274@newsgroups.borland.com> X-Newsreader: Forte Agent 1.91/32.564 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 216.207.211.30 X-Trace: newsgroups.borland.com 1039482109 216.207.211.30 (9 Dec 2002 17:01:49 -0800) Lines: 93 Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-03!sn-xit-06!sn-xit-08!supernews.com!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail