Performance Problem with "Or"-Statements in Form-Q

axafrank
Member Posts: 7
Our environment: Axapta 3.0 SP2, Oracle-Database, around 320 000 records in purchline-table
We have big performance troubles to execute Querys from Form (in ExecuteQuery-Methode on DataSource).
We don't have general problems, only with "OR-Statements" in the Query.
Sample:
Form with one DataSource (PurchLine) and one Grid in the Design. In the Grid are only the Fields PurchId, LineNum and ItemId.
Only the methode purchLine.executequery() ist modified from us.
If we change the QueryBuildRange-Line to
If we use a job to execute the same statement (two orders) it needs also only one second.
The axapta-tracelog shows the same sql-statement for both calls. The only difference is the hint /*+ FIRST_ROWS */ in the statement from the form-query.
What is our problem with the query from form?
please help us!
We have big performance troubles to execute Querys from Form (in ExecuteQuery-Methode on DataSource).
We don't have general problems, only with "OR-Statements" in the Query.
Sample:
Form with one DataSource (PurchLine) and one Grid in the Design. In the Grid are only the Fields PurchId, LineNum and ItemId.
Only the methode purchLine.executequery() ist modified from us.
public void executeQuery() { Query queryLine; QueryBuildDataSource queryBuildDataSourceLine; QueryBuildRange qbrPurchId; ; purchLine_ds.autoQuery(false); queryLine = new Query(); QueryBuildDataSourceLine = queryLine.addDataSource(tableNum(PurchLine)); qbrPurchId = QueryBuildDataSourceLine.addRange(fieldnum(PurchLine, PurchId)); purchLine_ds.query(queryLine); qbrPurchId.value(strfmt('%1,%2', sysQuery::value("5"), sysQuery::value("6"))); super(); }If we open the form, the super()-Call of the executeQuery-methode needs approximately 100 seconds.
If we change the QueryBuildRange-Line to
qbrPurchId.value(strfmt('%1', sysQuery::value("5")));then it needs only like one second.
If we use a job to execute the same statement (two orders) it needs also only one second.
static void BnQueryTest(Args _args) { PurchLine purchLine; Query query = new Query(); QueryBuildDataSource qbds; queryrun queryRun; ; qbds = query.addDataSource(tablenum(PurchLine)); qbds.addRange(fieldnum(purchLine, purchId)).value(strfmt("%1,%2", sysQuery::value("6"), sysQuery::value("7"))); queryRun = new queryrun(query); while(queryrun.next()) { purchline = queryrun.get(tablenum(purchline)); info(purchLine.PurchId); } }The oracle-statistik shows that the form-query causes the readin of approximatly 80 000 logical blocks, the job-query 1 000 logical blocks.
The axapta-tracelog shows the same sql-statement for both calls. The only difference is the hint /*+ FIRST_ROWS */ in the statement from the form-query.
What is our problem with the query from form?
please help us!
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