Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How my application is so slow with 30,000 records?
Message
From
18/04/1998 00:03:45
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00093105
Message ID:
00093110
Views:
27
Gil,
You're right SQL is cool and it would be fast doing it that way. But since we're getting used to buffering it would need some more touch and more speed gain (will be a lot as childs get crowded) would be doing that SQL once per parent change and keeping an array. Here is my scenario :
select sum(myMoney) into array myTotals where parid = mParentKey
* In lostfocus of num fields which affect the sum - here just one
myTotals[1] = myTotals[1] + (nvl(myMoney,0) - nvl(oldval("myMoney"),0))
* And textbox.controlsource showing total is myTotals[1]

Cetin

>An even better approach would be something like:
>
>SELECT childtable.clientid,COUNT(*),sum(childtable.moneys)AS TotalMoney FROM childtable,parentable WHERE childtable.clientid = parentable.clientid GROUP BY childtable.clientid ORDER BY TotalMoney DESC
>
>And it will give you some cool results, that's what SQl stands for, so cool
>
>Gil
>
>
>>"when i need sum the amount of the child table for each record in the primary table"
>>
>>Fernando,
>>
>>Are you using a program to do this or a query? A program will have a slower performance if you have to go to each record on the parent table and check for its links on the child table. But if you use an SQL statement performance can be sped up very nicely. I would do something like this:
>>
>>SELECT parentable.client,SUM(childtable.moneyfield) FROM parentable,childtable GROUP BY parentable.client
>>
>>You could also use the COUNT(*) command to actually count the number of transactions that generated the SUM() calculation.
>>
>>HTH
>>
>>
>>
>>
>>>I have a application and it works :
>>>
>>>have one primary table with 1200 people Information
>>>and I have aprox. 30,000 records in a child table and is very
>>>slow consult the child table with a relation, when i need sum the
>>>amount of the child table for each record in the primary table, the system is very slow, i have index on IDCliente in my primary table and
>>>i have an Index in my child table Idcliente for make a relation and the relation works ok, but my sysetm is so slow, what I'm doing bad?
>>>how can a give more speed to my application?
>>>
>>>Sorry for my English
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Previous
Reply
Map
View

Click here to load this message in the networking platform