🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.interbase.opensource
Article #163

Re: Slow fetching of large record table

#163
From: Gerard Vanderveken ghianospam.pi...
Date: Tue, 13 Sep 2005 00:08
43 lines
2961 bytes
"Bill Todd" <no@no.com> wrote:
>Does the file you receive contain all 200,000 records? If not, how many
>records does a typicla file contain.

Yes, it does. Every day there are between 100-500 modifications (keys added, keys deleted, data changed). 

>It sounds like you are bringing all 200,000 records to the client. How
>long that  will take depends on the speed of and load on your network
>but it will take a long time.

Yes, I'm doing a First and then a while not eof do processing and next loop.
I'm wondering why it takes so long. CPU load stays under 1% average at all times (peaks are 3 or 4 %)
Obviously, the CPU is more waiting then running. Is there not a way to make it more CPU intensive? 
I should think 100 minutes at 1% could be done in 1 minute at 100%?

>Either of the following approaches should be faster.
>
>1) Read the flat file one row at a time and SELECT the matching row
>from the database using the primary key. Then process the record on the
>client. To select the row from the database use an IBSQL component with
>a parameterized SELECT.

So, you think running 200 000 separate selects should execute faster? 
This will not be a one row select, because I have also to verify if there are database records in the gap between two flat file record numbers. Eg. select * from table where number between last_flat_file_number + 1 and flat_file_number order by number 

>2) Convert the flat file to fixed length format. Create an external
>table in the database that matches the fixed lenght file. INSERT the
>data from the external table into a table in the database (this would
>be a good place to use a temporary table if you are using IB 7.5.1). 

I'm using 6.02 (the freeware version).
Can this file for filling the table come from a stream? I preprocess the records already in a stringlist.

>Do the processing on the server.

You mean with a stored procedure?

>-- 
>Bill Todd (TeamB)
>
Thanks for looking into my problem.
Gerard Vanderveken.
Technical Details
Message-ID: <43261888$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.moat.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail
References: <43256774$1@newsgroups.borland.com> <4325d2a4$1@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 106772,9d3ef49be1dec05b
X-Google-Attributes: gid106772,public
X-Google-Language: ENGLISH,ASCII-7-bit
From: "Gerard Vanderveken" ghia_no_spam.pi.be
Sender: "Gerard Vanderveken" ghia_no_spam.pi.be
Reply-To: "Gerard Vanderveken" ghia_no_spam.pi.be
Subject: Re: Slow fetching of large record table
Newsgroups: borland.public.interbase.opensource
X-User-Info: 213.49.102.79     
References:  <43256774$1@newsgroups.borland.com> <4325d2a4$1@newsgroups.borland.com>
NNTP-Posting-Host: 207.105.83.66
Message-ID: <43261888$1@newsgroups.borland.com>
Date: 12 Sep 2005 17:08:40 -0700
X-Trace: newsgroups.borland.com 1126570120 207.105.83.66 (12 Sep 2005 17:08:40 -0700)
Lines: 43
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!news.moat.net!news-out.newsfeeds.com!propagator3-LAX.newsfeeds.com!news-in.superfeed.net!caladan.landsraad.net!newsgroups.borland.com!not-for-mail