• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1101
  • Last Modified:

Two TZQuery'ies connected via MasterSource

Hello Experts!

I have to TZQuery components.

They are providing data from two Master- Detail tables.

It looks like this:


select * from table1 where index = 1;


select * from table2;

These two TZQuery are connected together via MasterSource, MasterFields, LinkedFields and IndexFieldNames.

It works fine but slowly.

I wonder if I could make it work faster...?

Maybe I should avoid queries like:

select * from table2?

What is the best practice to realize this master- detail connection?

Thank you

  • 7
  • 2
1 Solution
Geert GOracle dbaCommented:
to provide tuning solution, you'll need to indicate what database you are using
in general:
minimize your column list (only select columns you really want)
minimize your rows returned (do you actually read more than 25 lines ?)

for master-detail you can usually combine in 1 query

  m.column1 master_col1,
  m.column2 master_col2,
  m.column3 master_col3,
  d.column1 detail_col1,
  d.column2 detail_col2
from table1 m
  left join table2 d on m.mastercolumn = d.mastercolumn
where m.index = 1;

displaying the data in the detail view can be done by applying a filter on the data in memory
Geert GOracle dbaCommented:
when tuning a problem the basics should be checked too:
network > amount of data to copy
local pc > cpu load, memory,
database type > local, server, load
query > optimal execution path ?
Geert GOracle dbaCommented:
delphi is all about code
if you don't supply code, it's mainly guessing where your problem is
A proven path to a career in data science

At Springboard, we know how to get you a job in data science. With Springboard’s Data Science Career Track, you’ll master data science  with a curriculum built by industry experts. You’ll work on real projects, and get 1-on-1 mentorship from a data scientist.

panJamesAuthor Commented:
"minimize your rows returned (do you actually read more than 25 lines ?)"

how do you make your query return only lets say maximum 25 lines?

Thank you

Geert GOracle dbaCommented:
database type ?
Geert GOracle dbaCommented:
select columns from table LIMIT 1, 25

select columns from table where rownum <= 25
> doesn't have a offset

in the properties of some query components you can find this:
FethAll: boolean; (default false)
FetchCount: 25; (default)

some grids like devexpress know this and can call FetchNext to get all data
Geert GOracle dbaCommented:
Zeos lib components don't have this functionality
you'll have to use other components or do it with sql
panJamesAuthor Commented:
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Easily Design & Build Your Next Website

Squarespace’s all-in-one platform gives you everything you need to express yourself creatively online, whether it is with a domain, website, or online store. Get started with your free trial today, and when ready, take 10% off your first purchase with offer code 'EXPERTS'.

  • 7
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now