Sytze, 
Firstly I would do like Paul suggests and split the unions up to catch data 
into three separate cursors curA, curB and curC then do a "select * from curA 
union all select * from curB ... into cursor curResult" etc. Doing it this way 
you can at least find out which select is taking the time using the rushmore 
settings that Jean detailed.

One thing to look at is the amount of deleted records you may/may not have in 
the tables. Your 500K records may be more if there are lots of deleted records 
you can't initially see because of your "set deleted" setting. Lots of deleted 
records in one section of the table really do screw up access times as the 
indexes become unbalanced. If this is the case then add an index on deleted() 
to the table. I have found, contrary to mainstream opinion that this 
dramatically improves SQL select access times despite the fact that it is well 
documented that it shouldn't. 

In addition as Jean also previously said change the syntax to be .. Date 
between trcask4 and trcask5 ...

You can bet that the solution will be trivial and staring you in the face... 
it's always that way!

Dave


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of 
Sytze de Boer
Sent: 12 September 2012 02:36
To: profox
Subject: Speed

I'm losing my mind over this

At a client site, they run a report which can take 30 mins to generate, over 
the network When they run it on a local pc, it takes 5 secs

Without boring you with all the details, essentially, the following code makes 
up the report *trcask4=a date *trcask5=a date

   Select Date,stockcode,stktype,invnum,qty,ttlamount,disc,ppb,cost,Desc,
"H" As SRCE From winhst   Where Between(Date,trcask4,trcask5) Union All;
   Select Date,stockcode,stktype,invnum,qty,ttlamount,disc,ppb,cost,Desc,
"I" As SRCE  From wininvs  Where Between(Date,trcask4,trcask5) Union All ;
   Select Date,stockcode,stktype,invnum,qty,ttlamount,disc,ppb,cost,Desc,
"J" As SRCE From wintime  Where Between(Date,trcask4,trcask5) Into Table
(myfile)

The Winhst file has about 500,000 records The other 2 less than a 1000 combined

There seems to be a big difference in time if no-ones else has logged into the 
app from a different workstation

Can anyone suggest a way to make this go quicker?


--
Kind regards
Sytze de Boer
Kiss Software


--- StripMime Report -- processed MIME parts ---
multipart/alternative
  text/plain (text body -- kept)
  text/html
---

[excessive quoting removed by server]

_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/profox
OT-free version of this list: http://leafe.com/mailman/listinfo/profoxtech
Searchable Archive: http://leafe.com/archives/search/profox
This message: 
http://leafe.com/archives/byMID/profox/[email protected]
** All postings, unless explicitly stated otherwise, are the opinions of the 
author, and do not constitute legal or medical advice. This statement is added 
to the messages for those lawyers who are too stupid to see the obvious.

Reply via email to