a record count question

Roelof
Member Posts: 377
I'm using version 5.00 but probably the previous version have the same problem.
I just have a big time to speed up a record count process. Im using the best keys I can create but if I do a rec.Count, it just takes for ever if the recordset is pretty large but the subset want I want to count is small. Like: 30 records on a total of 10.000.
Any help is welcome, because this makes me crazy.
I just have a big time to speed up a record count process. Im using the best keys I can create but if I do a rec.Count, it just takes for ever if the recordset is pretty large but the subset want I want to count is small. Like: 30 records on a total of 10.000.
Any help is welcome, because this makes me crazy.
Roelof de Jonghttp://www.wye.com
0
Comments
-
Hi Roelof,
Maybe a stupid question but have you done the following
before doing the COUNT
1) SETCURRENTKEY
2) SETRANGE or SETFILTER
then do the COUNT
hope this helps
Albert0 -
-
There is a built in function in Navision to make this process faster (but less accurate). Depending on where and how you're using the count it could help. If you are trying to build a progress bar or give the user some feedback and you don't need to be 100% accurate you can use the COUNTAPPROX function. The one downside is that it is only an approximation.
One other thing....what key are you using? Have you chosen a key that works well given the filters that you are applying? The keys can make all the difference when working with a recordset.0 -
Savatage wrote:note: you should be on 5.1
Do you know something that we don't know?David Singleton0 -
SQL or native?0
-
-
Hi,
Have you ever tried the following:
Add a decimal field "MyCount" to your table and fill this up with "initvalue" 1.
Instead of using the count or Countapprox function create a SumIndexField for this field and link this to your key your working with.
In your C/AL code place the necessary filters and use the calcsums function on the "MyCount" field.
So, the result is that NAV doesn't count the records to get to his numbers but uses the SIFT technology which makes it extremely fast!
It really speeds up performance...Dynamics Rules!0 -
Function COUNT isn’t optimized for native database. It must go to every record to make count. In SQL count function a terrible performance. So has alternative you could use SUMINDEX fields, don’t forget that performance will decrease during insert, to maintain SUMINDEX.0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions