Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SQL Select slows down when using (BUFFERING=.T.)
Message
From
26/05/2009 14:16:09
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Databases,Tables, Views, Indexing and SQL syntax
Title:
SQL Select slows down when using (BUFFERING=.T.)
Miscellaneous
Thread ID:
01402021
Message ID:
01402021
Views:
113
I have a SQL statement in a form method that I call from the AfterRowColChange() event of my input grid (see code below). The purpose it total the line item prices as the user is adding rows to the grid.

I am using table buffering, so I use "With BUFFERING=.T." to get the buffered records as well as the saved ones.

I have noticed that as the user adds more child rows to the grid (each Quote parent would have about 10 child line items), the form begins to get slower which you can "feel" as they tab from column-to-column or row-to-row. The method fires every time, which is by design, becuase they may have changed the Qty or Price column or deleted a row or added a row.

You typically add a new Quote (buffered header table record), then add about 10 buffered line items records, then hit save (TableUpdate). When adding new records, it gets slower after about the 4th record, and really slow (1-2 seconds) as you add more.

However, once the records are saved, if you then edit the records (A form mode), the speed is fine.

Are the buffered un-saved records slowing it down or what?

Also, I just noticed that there is not an index on the field "print". Maybe I need to add an index for it. But again, once you save the newly added records
Lparameters tiQuoteNo
*--------------------------------------------------------------------------
* Calculates the total quoted price all line items on the Quote.
* Stores the result into thisform.nSummaryQuoteTotal property
*--------------------------------------------------------------------------

 Select Sum(qty*price);
 From Quote With (BUFFERING = .t.);
 Where Quote.quote_no=tiQuoteNo and Quote.print=.t.;
 Into Array laQuoteTotal
 
 thisform.nQuoteTotalPrice=Nvl(laQuoteTotal, 0)
 
 Return thisform.nQuoteTotalPrice
.
Next
Reply
Map
View

Click here to load this message in the networking platform