0

Help code performance please.

I have a database that is used on investments. I am interested in tracking Weekly and Monthly turning points and their relationship with preceding ranges and following ranges to help inform decision making. So I have a range (from one turning point to another) and trying to look for the previous and following ranges. The code shows no issues but the when it runs it hangs in processing many times. The high end workstation ran for 45 hours on this and reported 1250 hangs during the processing before I had to "kill it". Both Cycles table and the PA table have 6000 rows in them. So looking for ideas to improve the performance please.

The code is in a button on the PA Table form and is divided into two buttons.  One for Previous related ranges (RRP) and another for following ranges (RRF).  The code for the former is :

do as server
delete (select RRP);
let ARY := (select PA);
let Tot := cnt(ARY);
for n in range(0, Tot + 1) do
let t := item(ARY, n);
let tid := number(t.Id);
let x := t.StartDate;
let y := t.StartHorL;
for p in (select Cycles)[End_Date = x and End_HorL = y] do
let q := (create RRP);
q.(PAref := number(tid));
q.(StartDate := p.Start_Date);
q.(SHorL := p.Start_HorL);
q.(SPrice := p.Start_TP_Price);
q.(EDate := x);
q.(EHorL := y);
q.(EPrice := p.End_TP_Price);
q.(Cdur := x - p.Start_Date);
q.(Tdur := q.Cdur * CtoT());
q.('CurrentRetrace%' := "StartDate - EDate)/PriceRange")
end
end
end

1 reply

null
    • Sean
    • 4 yrs ago
    • Reported - view

    I hope you meant 45 minutes instead 45 hours. Either way, you have way more patience than I do. "do as server" is probably the main problem and you should contact Ninox support directly to find out what the limitations of sever side processing are. You didn't mention which OS your workstation is running, but using the Mac app would definitely speed things up without using "do as server".