Recent

Author Topic: Optimise remote DB speed  (Read 2571 times)

sin_dragan

  • Full Member
  • ***
  • Posts: 127
Optimise remote DB speed
« on: June 18, 2015, 08:37:14 am »
Hi, I wrote an program to monitor some production process which uses MSSql2012 server on remote location. Used SqlDB components ,one DataModule for all DB related queries, transactions etc.

When I started writing program, the speed was fine. However, as I wrote all the modules the program became very slow when opening new form with dbgrid data. I always open sqlquery connection before form is shown, on close, I close all the queries for that form. I also use alot of Master-Detail relation ships (I link up to 3 queries).

But it's not that much data, I usually query up to 4 queries per form,

Can you give me some tips to optimise speed?
Windows 7 64 bit
Lazarus 1.4.1 (w/fixes) FPC 2.6.4 win32

LacaK

  • Hero Member
  • *****
  • Posts: 703
Re: Optimise remote DB speed
« Reply #1 on: June 18, 2015, 10:50:27 am »
Without knowing detail s it is hard to suggest.
You must identify source of slownes. If it is server, network or client.
How big are tables you query ? How big are data transfered through network ? What is speed when you execute queries on server machine ? etc.

sin_dragan

  • Full Member
  • ***
  • Posts: 127
Re: Optimise remote DB speed
« Reply #2 on: June 18, 2015, 01:17:41 pm »
I found out recently, ISP that hosted server had a major atack so that was the reason for slow connection, all of therir servers were slow. Tables are not big, also the data that I'm queriying also is not that big. I think I should stay away from Master/Detail with more queries, instead I plan to handle OnScroll event so if record changes it shoud update other "detail" datasets.

Thx @lacak, those quesitions are good to answer when similar situation happends. After this project I plan to try tiOPF to see if the performance is better, does anybody have expirience with this framework over the network?
Windows 7 64 bit
Lazarus 1.4.1 (w/fixes) FPC 2.6.4 win32

 

TinyPortal © 2005-2018