How to improve the performance of this query?

"neuzaalves" <[email protected]> Mon, 18 Aug 2003 17:20:20 -0000
Newsgroups gmane.comp.lang.delphi.programming
Message-ID <[email protected]>
Hi,

select A.* ,B.GPE_DESCR,C.SGE_DESCR,D.*  from EITEMBASE A ,EGRUPO 
B,ESUBGRUPO C ,EITEMBASECARAC D where A.GPE_ID=B.GPE_ID and 
C.SGE_ID=A.SGE_ID and D.ITB_ID=A.ITB_ID
order by GPE_DESCR,SGE_DESCR,ITB_DESCR

This is query was made to be used with a report.

As a former clipper programmer,i'm not used to some concepts or
i really think that books in Brazil does not care too much with 
performance.
Let'suppose that the table EITEMBASE have 200.000 records.
that will make the server sent to the client 200.000 times the
columns b.GPE_dESCR and C.SGE_DESCR although this colums have
only five possible values.
Wouldn't it improve the performance if I returned a cursor 
without this two columns,and return two auxiliar tables b and c.

In my program create a begin end, and everytime the fields
GPE_ID and SGE_ID changes in the table EITEMBASE I use locate
to look for the values of GPE_DESCR AND SGE_DESCR.
Basically the old clipper/dbf approach.

What is the best thing to do?  

Kind Regards,
Neuza




------------------------ Yahoo! Groups Sponsor ---------------------~-->
Buy Ink Cartridges or Refill Kits for Your HP, Epson, Canon or Lexmark
Printer at Myinks.com. Free s/h on orders $50 or more to the US & Canada. http://www.c1tracking.com/l.asp?cid=5511
http://us.click.yahoo.com/l.m7sD/LIdGAA/qnsNAA/i7folB/TM
---------------------------------------------------------------------~->

Delphi VCL Top Sites!
http://www.sandbrooksoftware.com/TS/TS2/Components.shtml
---------------------------------------------------------------
Unsubscribe:[email protected]
List owner:[email protected]
--------------------------------------------------------------- 

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/