Master/detail performance

Discussion of open issues, suggestions and bugs regarding PgDAC (PostgreSQL Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
piopio1
Posts: 32
Joined: Thu 10 Jan 2013 23:13

Master/detail performance

Post by piopio1 » Sun 15 Jun 2014 10:14

I have three tables:
  • tbl_customer_master_data
    tbl_currencies
    tbl_invoices.
I run the following select in PGQuery and link it to tbl_customer_master_data via master/detail (master=tbl_customer_master_data.customer_code and details=tbl_invoices.customer_code).

Code: Select all

SELECT
  tbl_invoices.customer_code,
  tbl_currencies.code,
  tbl_currencies.id
FROM tbl_invoices
INNER JOIN tbl_currencies
  ON tbl_invoices.currency = tbl_currencies.id
WHERE (tbl_invoices.update_date = '6/15/2014 12:00:00 AM')
AND customer_code = :customer_code
GROUP BY tbl_invoices.customer_code,
         tbl_currencies.code,
         tbl_invoices.currency,
         tbl_currencies.id
ORDER BY tbl_invoices.currency
  • tbl_customer_master_data has an index on customer_code
    tbl_invoices has index on customer_code, update_date and currency
    tbl_currencies has an index on id
It takes 1.872 sec, info taken from dbMonitor, for the query to complete the job when moving records in tbl_customer_master_data but if I run the query in PGAdmin III it takes only 122 ms.

What can I do in order to improve the performance ?

Many thanks
Pio Pio

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Master/detail performance

Post by azyk » Thu 19 Jun 2014 10:07

Unfortunately, we couldn't reproduce the problem. Please download the latest PgDAC version from our website http://www.devart.com/pgdac/download.html , update it, and try to reproduce the problem on this version.

piopio1
Posts: 32
Joined: Thu 10 Jan 2013 23:13

Re: Master/detail performance

Post by piopio1 » Thu 26 Jun 2014 10:21

You are right, the issue was elsewhere.

Thanks
Pio Pio

azyk
Devart Team
Posts: 1119
Joined: Fri 11 Apr 2014 11:47
Location: Alpha Centauri A

Re: Master/detail performance

Post by azyk » Thu 26 Jun 2014 13:37

Feel free to contact us if you have any further questions.

Post Reply