Board index » delphi » TTable vs TQuery vs TwwQuery vs TwwTable - SPEED

TTable vs TQuery vs TwwQuery vs TwwTable - SPEED

Hi, I have been timing the opening of tables using the following Delphi 4
components:

1. TTable   (Standard VCL)
2. TwwTable (InfoPower 4)
3. TQuery   (Standard VCL)

I have noticed a definitive difference in the time it takes to call the open
method on either of these three components.  The time it takes to open a table
is significantly longer against a local engine, so my discussion here will be
limited to that.  Here is a little background information.

 - I am running a local database engine under Sybase SQL
Anywhere(dbeng50.exe)  - My PC is a P2 - 450 with 256 megs of RAM  - I am
using Sybase SQL Anywhere 5.0  - I am using a datamodule and opening the
datasets in the create method.  - The table I used for my testing has the
following attributes      - 123 columns   - 26,000 records        - one
primary key       - 44 foreign keys       - 9 indices     - All the fields in
the Datasets were brought down as TField objects.     For TTables or
TwwTables      - One lookup field (The lookup field looked up into a table
with approximately 20  records and was opened prior to the test table. The
time it took to open this lookup  table NOT included in the time trial)  
For TQuery    - If the TQuery component was used the SQL was assigned at
design time.  The necessity  for a lookup field was satisfied by using a left
outer join between the lookup table  and the test table.  The Query's WHERE
clause used key fields to join the two tables.

Here is a listing with the time it took to open the test table.  Each table
was opened using the open method.

TTable   - approx. 09.000 seconds
TwwTable - approx. 18.340 seconds
TQuery   - approx. 00.660 seconds

As you can see the TQuery was far faster than TTable or TwwQuery.
What was even more surprising was that the 3rd party component, TwwTable was
more than twice as slow.
I ran this same test against other tables, some with and some without lookup
fields or joins and the
time it took to open tables was largely dependant upon the type of dataset
used.  Can someone explain
the reasons behind this?  These are some of the questions I hope to resolve?

1. Why is a local engine so much slower than the server engine?
   I know that the server engine is faster at processing requests - but why?

2. Why are TQueries faster than TTables or TwwTables?

3. Why is the TwwTable so much slower than TTables?

4. Do Foreign keys or indices provide a larger overhead when opening the
dataset?  If so WHY?

Any help on this matter would be greatly appreciated.

Sincerely,
Joey Ebright
ebrig...@pacbell.net

-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/       Search, Read, Discuss, or Start Your Own    

 

Re:TTable vs TQuery vs TwwQuery vs TwwTable - SPEED


Is the tQuery returning a live result set?

Re:TTable vs TQuery vs TwwQuery vs TwwTable - SPEED


Quote
On Mon, 05 Apr 1999 21:14:58 GMT, ebrig...@my-dejanews.com wrote:
>Hi, I have been timing the opening of tables using the following Delphi 4
>components:

>1. TTable   (Standard VCL)
>2. TwwTable (InfoPower 4)
>3. TQuery   (Standard VCL)

>I have noticed a definitive difference in the time it takes to call the open
>method on either of these three components.  The time it takes to open a table
>is significantly longer against a local engine, so my discussion here will be
>limited to that.  Here is a little background information.

> - I am running a local database engine under Sybase SQL
>Anywhere(dbeng50.exe)  - My PC is a P2 - 450 with 256 megs of RAM  - I am
>using Sybase SQL Anywhere 5.0  - I am using a datamodule and opening the
>datasets in the create method.      - The table I used for my testing has the
>following attributes          - 123 columns   - 26,000 records        - one
>primary key   - 44 foreign keys       - 9 indices     - All the fields in
>the Datasets were brought down as TField objects.     For TTables or
>TwwTables      - One lookup field (The lookup field looked up into a table
>with approximately 20  records and was opened prior to the test table. The
>time it took to open this lookup  table NOT included in the time trial)  
>For TQuery    - If the TQuery component was used the SQL was assigned at
>design time.  The necessity  for a lookup field was satisfied by using a left
>outer join between the lookup table  and the test table.  The Query's WHERE
>clause used key fields to join the two tables.

>Here is a listing with the time it took to open the test table.  Each table
>was opened using the open method.

>TTable   - approx. 09.000 seconds
>TwwTable - approx. 18.340 seconds
>TQuery   - approx. 00.660 seconds

How does the amount of cache you allocate to the server affect speed?

Is the primary key in your test table used as a foreign key by other
tables?  How many?  What is the sort order for the test table?

Are you running separate programs to test these things, or doing them in
sequence in one program?  If it's one program, and the database is set
to autostop, then some of the time for the first test is loading indexes
into cache on the server, and later tests could be benefiting from that.

--
"Oh, shootings.  Yes, but that doesn't mean Americans are more {*word*268}
than other people.  We're just better shots."

Other Threads