473,387 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

access plan with sequence in params

Hmm... Simple select through primary key

1. SELECT REFERENCE FROM CCTL.DOCSTSREG WHERE DOCID=?
2. SELECT REFERENCE FROM CCTL.DOCSTSREG WHERE DOCID=(PREVVAL FOR
CCTL.sq_docidstsreg)

1 - no problems, 2 - TABLESCAN! Why?!!

1.Access Plan:
-----------
Total Cost: 50.0199
Query Degree: 0

Rows
RETURN
( 1)
Cost
I/O
|
1
FETCH
( 2)
50.0199
2
/---+--\
1 23411
IXSCAN TABLE: CCTL
( 3) DOCSTSREG
25.017
1
|
23411
INDEX: CCTL
PK_DOCSTSREG

2. Optimized Statement:
-------------------
SELECT Q1.REFERENCE AS "REFERENCE"
FROM CCTL.DOCSTSREG AS Q1
WHERE (Q1.DOCID = INTEGER($INTERNAL_FUNC$()))

Access Plan:
-----------
Total Cost: 4869.35
Query Degree: 0

Rows
RETURN
( 1)
Cost
I/O
|
1
TBSCAN
( 2)
4869.35
1236
|
23411
TABLE: CCTL
DOCSTSREG

-----------------------------------------------------
DB21085I Instance "DB2" uses "32" bits and DB2 code release "SQL08020"
with
level identifier "03010106".
Informational tokens are "DB2 v8.1.7.445", "s040812", "WR21342", and
FixPak
"7".

Andy

Nov 12 '05 #1
1 1083
bughunter@ru wrote:
Hmm... Simple select through primary key

1. SELECT REFERENCE FROM CCTL.DOCSTSREG WHERE DOCID=?
2. SELECT REFERENCE FROM CCTL.DOCSTSREG WHERE DOCID=(PREVVAL FOR
CCTL.sq_docidstsreg)

1 - no problems, 2 - TABLESCAN! Why?!!

I think(!) this will be fixed in FP9. Call support to be sure.

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Sean C. | last post by:
Helpful folks, Most of my previous experience with DB2 was on s390 mainframe systems and the optimizer on this platform always seemed very predictable and consistent. Since moving to a WinNT/UDB...
5
by: sql-db2-dba | last post by:
We have DB2 UDB v8.1 fixpak3 on AIX 5. Production and Development configuarations (at least for DB2) are identical albeit production is a 2-way server while development has only one processor....
22
by: Marc Mones | last post by:
Hello, I'working with IBM DB2 V8.1 and CLI/ODBC. I've got a problem with the following statement: ******************************************************************************** SELECT...
6
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
1
by: Leonid | last post by:
Hello I have VC++ .NET 2003 ATL Server project. In one of its method I need to write some information in a local txt file. This txt file and this ATL Server are on the same ‘C: \’ drive. When...
17
by: DaveG | last post by:
Hi all I am planning on writing a stock and accounts program for the family business, I understand this is likely to take close to 2 years to accomplish. The stock is likely to run into over a...
0
by: db2group88 | last post by:
Hi, we are using db2 v8.2 on windows , EE edition. Sometimes while i execute Create Table like oldTable to try to create a copy table, i got sql error 911 with dead lock message, but when i do...
38
by: Oldie | last post by:
I have built an MS Access Application under MS Office XP (but I also own MS Office 2000). I have split the application in the pure database tables and all the queries, forms, reports and macro's. ...
5
by: vaniKanabathy | last post by:
Hi...I had a question regarding sequence utilization in query. I have an access database where i add a new field which is AltId where i want the field to filled with numeric values that start from 1....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.