Article View: borland.public.cppbuilder.database.multi-tier
Article #867Re: speeding up my app
From: Jerry Bloomfield (TeamB)
Date: Sun, 04 Feb 2001 17:12
Date: Sun, 04 Feb 2001 17:12
51 lines
3846 bytes
3846 bytes
On Fri, 2 Feb 2001 14:21:50 +0200, "Quentin Hurt" <hurt@ecoserv.co.za> wrote: >Hi, please can someone give me advise on how to make my application run and >load faster. I have developed a two tiered database application (databases >on the server & and an application on each client) and use eight different >paradox tables. I realise that opening and closing tables takes time but >what is the general rule of thumb for keeping process times short i.e.. open >them all on start up or when necessary? (There are about 12 client >machines) Also. any other coding tips will be useful. My first suggestion to you is that you should be using a TQuery component rather than a TTable components. You do not explicitly say which you are using, so I am sorry if you already are using TQuery components. Next, I will suggest that you use a TDatabase component to connect your TQuery to the actual "database". When you use a TDatabase, use Persistent Connections (KeepConnection = true). In my experience, the biggest performance hit an application takes with a database is initializing the connection to the database. By using the persistent connections, you reduce this to only the times when your TDatabase is set Active. If you are using a TQuery component, only select the records you need, using an appropriate "WHERE" clause in your SQL command. Pulling additional records into your application will only slow you down by increasing the number of records you have to process, as well as increasing the virtual memory required to hold the results of your TQuery. If you can build an index over the fields you will be querying against, it can also improve your "lookup time", but this can have a negative impact on your insert/update time, so YMMV with this one. When using a TQuery, avoid using any of the TQuery methods which cause a "Fetch All" to be executed, as this will cause the TQuery to pull in the entire results set before you can continue processing. One example of something to avoid for this reason is the RecordCount property, as it needs to get all of the rows in the result to know how many are there. Using the above information, I was able to show a co-worker how to improve his performance in one application at the office. He was using a TTable which would take about 2 minutes to open or refresh, but he could Locate to the record he wanted in about 200 milliseconds. By converting to a TQuery (using persistent connections via a TDatabase) we reduced the initial open to about 25 seconds, and the TQuery would return the result in about 250 milliseconds. This was querying against an Access97 MDB file on a local hard disk using ODBC on a table with about 1.25 million rows. Jerry Bloomfield (TeamB) -- http://www.teamb.com JersWork@wwa.com Please do *NOT* send private e-mail without prior permission (my anti-spam filters will probably just delete it anyway <g>)
Technical Details
Message-ID:
<8v0r7ts5f83aksv4dulc1c726k510ulob7@4ax.com>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!news.tele.dk!130.133.1.3!fu-berlin.de!news.bnb-lp.com!bornews.borland.com!not-for-mailReferences:
<3a7aa713_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fcd2b,36cc388b10300a1 X-Google-Attributes: gidfcd2b,public X-Google-ArrivalTime: 2001-02-04 09:12:13 PST From: "Jerry Bloomfield (TeamB)" <JersWork@wwa.com> Newsgroups: borland.public.cppbuilder.database.multi-tier Subject: Re: speeding up my app Date: Sun, 04 Feb 2001 11:12:09 -0600 Organization: LSVFA - Latest Software Version Freaks Anonomous Lines: 51 Message-ID: <8v0r7ts5f83aksv4dulc1c726k510ulob7@4ax.com> References: <3a7aa713_2@dnews> NNTP-Posting-Host: 157-238-73-216.il.verio.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Newsreader: Forte Agent 1.8/32.548 Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!news.tele.dk!130.133.1.3!fu-berlin.de!news.bnb-lp.com!bornews.borland.com!not-for-mail