Question

Delphi TIBDataset component very slow over LAN

Asked by: Marius0188

Hi Friends,

I have a Delphi application using an Interbase database over a LAN.
All the pc are high spec Pentium 4's with 1Gbs LAN interface cards.

My database set up looks like this:
TIBDataset -> TIBTransaction -> TDataSource.
(Hope this is graphical enough :) )

Everything is working fine but the speed is tremendous slow.
When I connect a DBGrid to the Customer table's Datasource and scroll
through the records by clicking with the mouse on a row in the DBGrid,
it takes about 2 - 4 seconds to select the row.

Is there any good reason why this is so slow?
Please advice.

Thanks in advance!

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2006-04-24 at 07:55:14ID21824911
Tags

tibdataset

,

delphi

Topic

Delphi Programming

Participating Experts
3
Points
125
Comments
14

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Mutliple Datasources in DBGrid
    How can I gave multiple datasources in a single DBGrid? I have a Master tables that has several details tables (5). I want only certain coulmns from each detail table to appear in the grid. How can I do this? The solution given must allow a quick update of the DBGrid, so ...
  2. New events in DBGRID
    With DBGRID standard in Delphi, how can i control the events CellEnter, CellExit, RowChanged?
  3. How to insert a checkbox in a DBGrid cell in Delphi
    I'm a Delphi rookie and I'm working on my first application, I'm using a DBGrid that shows information from a table that has some columns with boolean (true/false) data, I'd like to know if there is any way to show those columns as checkboxes in the grid cells. I've done thi...
  4. DBGRID
    Since DBGrid contains in a row more info. that can be displayed on screen is it possible to block (freeze column) first row and scroll the rest? have a button etc...???
  5. DBGrid
    my form has one table, one DataSource and one DBGrid. I made an alias which points to database.mdb. I choose this alias from table. datasource = table1. And DBGrid = datasource1. I have 5 records on my database. But my DBGrid shows 10 records. Which are also same as my 5 reco...
  6. Delphi 6 with DBGrid
    Hell Experts I just installed delphi 6 Enterprise edition today and I'm testing dbexpress with oracle database, I added SQLConnection and SQLTable to connec to the database, and I added Dbgrid, and when I try to connect the dbgrid with datasource property it gave m...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: JDSkinnerPosted on 2006-04-24 at 16:47:56ID: 16530461

Hi
You may have already done this but:-
Try using TibQuery linked to a DataAccess Datasource component
For basic setup look have a look at
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_21733796.html

To speed up any updates then use local dataset caching:
While TibQuery.Active is set to false, set TibQuery.CachedUpdates to true
then reset TibQuery.Active to true. This allows for local caching of Inserts, updates and deletes.

Make sure that the TibQuery.SQL is set to something like
Select <fieldlist> from table
Where < some condition > (optional)
Order by <field or fieldlist>

The Order by field / fieldlist should ideally is already indexed although an index will be created if its not already available.
Run the SQL query on a database tool such as Database Workbench
http://www.upscene.com/
This will show you how fast the query can be run.

If you use the TibQuery.CachedUpdates don't forget to use TibQuery.ApplyUpdates befor you commit your changes.

 

by: Marius0188Posted on 2006-04-24 at 22:22:02ID: 16531715

What will be the best configuration / set up for interbase database over LAN in terms of components to use?

For example:
1. Should I use TIBDataset components in conjuction with DB Components?
2. TIBTable components in conjuction with DB components?
3. TIBQuery components in conjunction with NON-DB components?
etc...
etc...

Cause I have changed all by TIBDatasets to TIBTables and there is already a little speed improvement.

 

by: pcsentinelPosted on 2006-04-25 at 00:37:07ID: 16532216

My own opinion is that you should always try and avoid useing table and query components, the best method for returning data is to use a stored procedure both to return data and to do updates,

Why? well using sp's means that only the data that you want is returned to the application rather than the entire table. Take for instance a Client table, this might have many fields from name, address, registration date etc, etc, etc. If you use a table component then evry field will be returned across the network, normally you only want a subset of those fields, you could use a query to return taht subset, but there is inherent overhead in decoding, interpreting and  processing that qurey whereas using an sp this query is already stored within the db and is optimised.

Also use sp's for doing updates, is say you just wanted to update a date in a record, it is much more efficient to just pass the new date to a query than to edit a reord locally, which would have to pass bakc the entire record for the update.

regards

 

by: JDSkinnerPosted on 2006-04-25 at 03:49:44ID: 16533025

Don't use TIBTables over a LAN they are more for desktop applications
TibQuery is more scaleab;e to LAN requirements

Never use a TibQuery filter over the network as all records are called and the filter applied locally, this is SLOW.
If you use TiBQuery make sure that the SQL query is addressed to just the required subset.

In general TibStoredProcs are the thing to go for as these will connect you to the database's Stored Procedures. You can centralise you business logic within the database. Different delphi units can address the common logic stored within the Special Procedures, this cuts down on logic errors and is as fast way to extract a data subset as all the work in done on the server.
 

 

by: Marius0188Posted on 2006-04-25 at 04:06:06ID: 16533104

1) Where will I find good documentation and/or tutorials on Stored Procedures?
    If I understand correctly I can do SELECTS / INSERTS / UPDATES / DELETES  by means of Stored Procedures?

2) I have never worked with SP before.
    Does every table need a SP for each of the following (for example only):
    1. Inserting record (SP1)
    2. Deleting record (SP2)
    3. Updating record (SP3)

3) Can you show my an example of SP for doing INSERT, please?

 

by: kretzschmarPosted on 2006-04-25 at 04:14:43ID: 16533137

>it takes about 2 - 4 seconds to select the row.
so the relocation takes time
causes:
- many data in the dataset and no PK or Index is used or contained in the dataset
- not stable network

meikl ;-)

 

by: Marius0188Posted on 2006-04-25 at 04:28:27ID: 16533197

>>so the relocation takes time
>>causes:
>>- many data in the dataset and no PK or Index is used or contained in the dataset
>>not stable network

Shouldn't take that long.
Just 4 records in the table.
Network is 100%.  Tested.
PK Ok.

 

by: kretzschmarPosted on 2006-04-25 at 04:35:51ID: 16533241

>Just 4 records in the table.
only four (in numbers: 4) records???

just a
select * from atable???

thats really too long

do you have any other tool for testing performance than delphi?
(maybe the problem is far on another side, maybe an installation and/or configuration problem)

meikl ;-)

 

by: Marius0188Posted on 2006-04-25 at 04:43:11ID: 16533293

It's already lots faster.
I did allot of
Dataset.Close & Dataset.Open 's in order the update the data thats displaying, so I realize
now this slowed it down allot. Even on only couple on records.

But I would like to do it the correct way.
So now it's more a matter of what is the best and most correct way.
I know there are always lots of correct methods.

But I have heard allot about Stored Procedures and would like to get that
comment of mine answered:

--------------------PREVIOUS COMMENT-------------------------------------------------------------------------------
1) Where will I find good documentation and/or tutorials on Stored Procedures?
    If I understand correctly I can do SELECTS / INSERTS / UPDATES / DELETES  by means of Stored Procedures?

2) I have never worked with SP before.
    Does every table need a SP for each of the following (for example only):
    1. Inserting record (SP1)
    2. Deleting record (SP2)
    3. Updating record (SP3)

3) Can you show my an example of SP for doing INSERT, please?

 

by: pcsentinelPosted on 2006-04-25 at 04:46:43ID: 16533311


****Insert procedure*****

CREATE PROCEDURE TESTINSERT (
    ACCOUNT INTEGER,
    MTD DECIMAL(15,2))
AS
begin
  INSERT INTO "2002Aug" ("Account", "Dept")
  VALUES (:account, :MTD);
end

 

by: pcsentinelPosted on 2006-04-25 at 04:56:16ID: 16533363

***select procedure****

CREATE PROCEDURE TESTSELECT (
    SELACCOUNT INTEGER)
RETURNS (
    ACCOUNT INTEGER,
    MTD DECIMAL(15,2))
AS
begin
  FOR SELECT "Account", "MTD"
  FROM "2002Aug" WHERE "Account"=:selaccount
  INTO :Account,:mtd DO
  suspend;
end

 

by: Marius0188Posted on 2006-04-25 at 05:04:53ID: 16533410

1) Ok, and then from your application how do you call the SP?

2) Where will I find good documentation and/or tutorials on Stored Procedures?
    If I understand correctly I can do SELECTS / INSERTS / UPDATES / DELETES  by means of Stored Procedures?

 

by: pcsentinelPosted on 2006-04-25 at 05:25:38ID: 16533534

Check out the Interbase Developers guide for onfo on writing SPs

http://firebird.sourceforge.net/index.php?op=doc&id=userdoc

 

by: JDSkinnerPosted on 2006-04-26 at 14:09:19ID: 16548145

You can also do a variety of other functions with Stored Procedures such as count totals rows in Table, get column totals
for various conditions etc.
         
In the example setup hyperlink that I referred to in an earlier comment add the following component to the Form:
   
Interbase Tab:-  ibStoredProc
   
If you use the Borland interbase sample database Employee.gdb that ships with interbase when packaged with Delphi, then you can list the Procedures via the ibStoredProc.StoredProcName property.
   
But first set the ibStoredProc.database property to point to the required ibDatabase component. ie. Employee.gdb
          
When you select one of the Procedures from the drop down list, the ibStoredProc.Params property will have a list of the Params required for the selected Procedure. If you highlight any Paramin the Params list, its properties can be viewed.
   
Set a button to run the Procedure via the ibStoredProc using the Buttons OnClick event.

Use the code template indicated below to load parameters, if required and run the procedure
   
{ Load input parameters }
with <SpecialProcName1> do
begin
      Params.Clear; { Wipe any previous params }
      ParamByName('<InputName1>').AsInteger:= <inputVariable1>;
      ParamByName('<InputName2>').AsString:= <inputVariable2>;
      // ... etc:
      Prepare;
      ExecProc;
      { If there are any returned results, load them here }
      <ResultVariable>:= ParamByName('<OutputName>').AsInteger;
      // ... etc:
end;

As for documentation, try Chapter 10 of the Embedded SQL Guide that ships with Interbase in PDF format, this covers the Interbase end.

All you need for the Delphi end can be picked up by clicking on the Interbase Tab:-  ibStoredProc component and then pressing F1 and reading the help. Its a very simple component to use.
            

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...