Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General Discussion » View Thread |
Messages 1 to 10 of 18 total |
Help needed to speed things up |
Tue, Apr 5 2011 11:36 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Hopefully someone knows about these things and will be able to give me a pointer. I'm presenting a grid to users to allow them to add or delete from a selection. Using Mike Skolnik's DBGrid I can have a tick box for selected rows. I've tried two approaches:
Companies.First; while not Companies.Eof do begin if CompanyIP.Find(Companies_ID.AsString, Junk) then CompanyList.SelectedRows.CurrentRowSelected := True; Companies.Next; end; for Cntr := 0 to CompanyIP.Count - 1 do begin if Companies.Locate('_ID', StrToIntDef(CompanyIP[Cntr], -1), []) then CompanyList.SelectedRows.CurrentRowSelected := True; end; The second is faster but still to slow. I have to use Locate rather than FindKey because the table is presented in company name sequence rather than id sequence. _ID is the primary key. DBGrids don't come with a beginupdate / end update. I'm using DisableControls at the start of the loop and enabling at the end. Since its altering a visual control I can't push it off into a background thread (it may be possible but I don't know how). All sensible suggestions will be warmly received (especially if they work). Roy Lambert |
Wed, Apr 6 2011 3:52 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Found one alternative which is a bit faster
Companies.Filter := '_ID IN ('+CompanyIP.CommaText+')'; Companies.Filtered:=True; Companies.First; while not Companies.Eof do begin CompanyList.SelectedRows.CurrentRowSelected := True; Companies.Next; end; Companies.Filtered:=False; Companies.Filter:=''; Companies.First; but still looking for something better. Roy Lambert |
Tue, Apr 12 2011 4:52 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | |
Wed, Apr 13 2011 2:53 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
>Where is the CompanyIP list coming from ? Its a sorted stringlist. On opening the form its derived from a query SELECT LIST(CAST(_fkCompanies AS VARCHAR) USING #13) AS _CompanyIP, LIST(CAST(_fkContacts AS VARCHAR) USING #13) AS _ContactIP FROM Calls WHERE _fkProjects = :ProjectID but then as companies are added to / deleted from the plan during the session the stringlist is adjusted. Essentially its the approach I use to obtain allow a table to be used when I want to filter it in a way that involves JOINs Roy Lambert |
Tue, Apr 19 2011 5:50 PM | Permanent Link |
Tim Young [Elevate Software] Elevate Software, Inc. timyoung@elevatesoft.com | Roy,
<< Its a sorted stringlist. On opening the form its derived from a query >> If you were to use a temporary table instead, you could leverage that to use joins/sub-queries against it that might be a bit faster. -- Tim Young Elevate Software www.elevatesoft.com |
Wed, Apr 20 2011 3:03 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | Tim
><< Its a sorted stringlist. On opening the form its derived from a query >> > >If you were to use a temporary table instead, you could leverage that to use >joins/sub-queries against it that might be a bit faster. Your memory is fading From my previous post "Essentially its the approach I use to obtain allow a table to be used when I want to filter it in a way that involves JOINs" Note the concept of filter in there. Until you let me use joins in a filter and keep table sensitivity I have to stick with this approach. Roy Lambert |
Wed, Apr 20 2011 5:19 AM | Permanent Link |
John Hay | Roy
> Found one alternative which is a bit faster > > > Companies.Filter := '_ID IN ('+CompanyIP.CommaText+')'; > Companies.Filtered:=True; > Companies.First; > while not Companies.Eof do begin > CompanyList.SelectedRows.CurrentRowSelected := True; > Companies.Next; > end; > Companies.Filtered:=False; > Companies.Filter:=''; > Companies.First; > > > but still looking for something better. What takes the time, the setting of the filter or the iteration setting of the selected status? John |
Wed, Apr 20 2011 5:49 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | John
>What takes the time, the setting of the filter or the iteration setting of the selected status? Good question. A couple of weeks ago I might have been able to answer it. When I've finished messing with my accounts for the taxman I'll add some gettickcounts in and let you know. Roy Lambert |
Wed, Apr 20 2011 9:27 AM | Permanent Link |
John Hay | Roy
> Good question. A couple of weeks ago I might have been able to answer it. When I've finished messing with my accounts for the taxman I'll add some gettickcounts in and let you know. > It's not January 30th yet is it ? John |
Wed, Apr 20 2011 9:53 AM | Permanent Link |
Roy Lambert NLH Associates Team Elevate | John
The answer is - I'm confused The form involved is used for planning which companies to add to a call plan. There are c7,000 companies. The form inherits from my standard company form but adds check boxes to a dbgrid. The initialisation puts ticks into the checkboxes for those companies that are already in the plan. The problem splits into three parts Part 1: Populate the stringlist with IDs of the companies already in the plan - this is done using SELECT LIST..... and is pretty fast. Part 2: Use the above stringlist to set a filter on the companies table Part 2: walk through the filtered table ticking the checkboxes I tried two different plans and ran it twice for each and here's where the fun starts Plan 1 - 629 companies in the plan Part 1 - 63, 47 Part 2 - 141,140 Part 3 - 483, 484 Plan 2 - 25 companies in the plan Part 1 - 16, 32 Part 2 - 640, 531 Part 3 - 0, 15 These were done using a local database So I then tried it out over my 100Mb LAN Plan 1 Part 1 - 63,31,31 Part 2 - 32, 31, 31 Part 3 - 468, 328, 328 Plan 2 Part 1 - 436, 15, 16 Part 2 - 94, 109, 93 Part 3 - 0, 0, 0 Roy Lambert |
Page 1 of 2 | Next Page » | |
Jump to Page: 1 2 |
This web page was last updated on Saturday, May 4, 2024 at 12:54 AM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |