473,603 Members | 2,604 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Query access path question

Hi,

I am trying to understand why following simple query is running very
slow (33 hours)

select ROW_ID
, a.CREATED
, a.CREATED_BY
, a.LAST_UPD
, a.LAST_UPD_BY
, a.MODIFICATION_ NUM
, a.CONFLICT_ID
, a.ROW_ID
, a.OWNER_PER_ID
, a.ROW_STATUS
, a.ASGN_DNRM_FLG
, coalesce(a.ASGN _MANL_FLG, 'Y')
, a.ASGN_SYS_FLG
, a.APPT_REPT_FLG
, a.APPT_REPT_END _DT
, a.APPT_START_DT
, a.TODO_PLAN_END _DT
, a.TODO_PLAN_STA RT_DT
, a.ALARM_FLAG
, a.CAL_DISP_FLG
, a.TEMPLATE_FLG
, a.EVT_STAT_CD
from S_EVT_ACT a
where OWNER_PER_ID is not null
The table S_EVT_ACT has about 78M rows and the query above is expected
to select 76M rows. The access path chosen by DB2 optimizer selects
indexed access. Index defined is

CREATE INDEX "SIEBEL "."S_EVT_ACT_M6 " ON "SIEBEL "."S_EVT_AC T"
("OWNER_PER_ ID" ASC,
"APPT_START _DT" ASC,
"APPT_START _TM" ASC) PCTFREE 30 ;

The stats (on key columns with distribution) are updated, index is not
clustering and the filter factor according to db2exfmt is 0.997.

If I drop the index, DB2 performs tablescan and the query runs in about
an hour (versus 33 hours). This is probably due to prefetching during
table scan, versus no prefetching during non-clustered index access.

Why DB2 chooses to select more expensive indexed scan and what can I do
to make DB2 optimizer select a better access path without dropping the
index or modifying the sql?

TIA

P. Adhia
Aug 12 '06 #1
2 3505
P Adhia wrote:
Hi,

I am trying to understand why following simple query is running very
slow (33 hours)

select ROW_ID
, a.CREATED
, a.CREATED_BY
, a.LAST_UPD
, a.LAST_UPD_BY
, a.MODIFICATION_ NUM
, a.CONFLICT_ID
, a.ROW_ID
, a.OWNER_PER_ID
, a.ROW_STATUS
, a.ASGN_DNRM_FLG
, coalesce(a.ASGN _MANL_FLG, 'Y')
, a.ASGN_SYS_FLG
, a.APPT_REPT_FLG
, a.APPT_REPT_END _DT
, a.APPT_START_DT
, a.TODO_PLAN_END _DT
, a.TODO_PLAN_STA RT_DT
, a.ALARM_FLAG
, a.CAL_DISP_FLG
, a.TEMPLATE_FLG
, a.EVT_STAT_CD
from S_EVT_ACT a
where OWNER_PER_ID is not null
The table S_EVT_ACT has about 78M rows and the query above is expected
to select 76M rows. The access path chosen by DB2 optimizer selects
indexed access. Index defined is

CREATE INDEX "SIEBEL "."S_EVT_ACT_M6 " ON "SIEBEL "."S_EVT_AC T"
("OWNER_PER_ ID" ASC,
"APPT_START _DT" ASC,
"APPT_START _TM" ASC) PCTFREE 30 ;

The stats (on key columns with distribution) are updated, index is not
clustering and the filter factor according to db2exfmt is 0.997.

If I drop the index, DB2 performs tablescan and the query runs in about
an hour (versus 33 hours). This is probably due to prefetching during
table scan, versus no prefetching during non-clustered index access.

Why DB2 chooses to select more expensive indexed scan and what can I do
to make DB2 optimizer select a better access path without dropping the
index or modifying the sql?
Could it be the table is defines as VOLATILE?
Also it would be really interesting to know how much of that time is
spent on the wire (processing 78M rows should not take 1hr, not to
mention 33hrs).
To test this the easiest is probably to run a MAX() on each column.
This way Db2 does the same processing but will return only one row.

Cheers
Serge
--
Serge Rielau
DB2 Solutions Development
IBM Toronto Lab

IOD Conference
http://www.ibm.com/software/data/ond...ness/conf2006/
Aug 12 '06 #2
Serge Rielau wrote:
Could it be the table is defines as VOLATILE?
Are you sure you don't have a second job working as a psychic? :)

You are right. Knowing the table, I never would have thought this table
to be defined as volatile, but again I have been wrong numerous times
before!
Also it would be really interesting to know how much of that time is
spent on the wire (processing 78M rows should not take 1hr, not to
mention 33hrs).
I didn't tell the whole story; although select is skinny, the table
itself is somewhat fat (1810 row length, 138G not counting indexes). The
select was actually a part of an insert sql, so counting insert of 76M
rows and log overhead, one hour doesn't sound too much. Or does it?
To test this the easiest is probably to run a MAX() on each column.
This way Db2 does the same processing but will return only one row.
Much faster. 12 minutes.
>
Cheers
Yes it did bring cheers to me.
Serge
Thanks
Aug 13 '06 #3

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

Similar topics

2
1882
by: wimmie | last post by:
Hello to all, I have a 'small' problem. I have made a application in php that connect trough ODBC to a Oracle RDB (VMS) or Basis+ database (VMS) and present the data to a user. There are 2 Oracle databases in diffrent city's and 5 Basis+ databases allso in diffrent city's. Now we have to logon to each database and can ask a question. My goal is now that on one question all databases give, when present, all its data. Is that possible...
7
8842
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I want my users to be able to select a report, click on a command button on a form, which will then automatically create the report as a pdf file and save it to the user's machine. I am using Adobe Acrobat (5.0 I think) and have Adobe Distiller as a
11
6579
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on where the job is running, the job runs sucessfully, PDF files got generated, everything is good. If I scheduled the job to run at the time that I am not logged into the server, Access is not able to print to the printer. The error is pretty...
15
5636
by: Rolan | last post by:
There must be a way to enhance the performance of a query, or find a plausible workaround, but I seem to be hitting a wall. I have tried a few tweaks, however, there has been no improvement. Simply, I'm including one calcualtion from a separate table/query. It sums the total units sold to date by ProductID number and is used in other select queries to perform various calculations. Perhaps there is an advantage in working with a maximum...
3
7655
by: Jim Lewis | last post by:
I have read several things that state accessing a Web Service through a Query String should work. However, when I try to execute http://localhost/webservice1/service1.asmx/HelloWorld I get the error below. Can I access a Web Service through a Query Sting. I need to send XML to a Flash movie using a Web Service. Thank You, Jim Lewis Server Error in '/WebService1' Application.
0
9960
ADezii
by: ADezii | last post by:
One frequently asked question at TheScripts is "Should I use a Stored Query or an SQL Statement in those situations that require a Query (RecordSets, RecordSources, Append, Delete, Update Operations, etc.)?" The response, in virtually all but a few circumstances, is that you should use a Stored Query in place of the parallel SQL Statement. The brief explanation that follows will explain the reasoning behind this: When you store a Query as a...
46
10062
by: OldBirdman | last post by:
What a mess this question is. I have spent 2 weeks trying to make it concise and clear, and I can't. I do not have the vocabulary for the question. I cannot even TITLE it correctly. Here is my best effort. Conditions: 80,000+ pictures (These are pictures of birds, ID by Species, Sex, Age, etc. (If known)) Hierarchy of folders: Continent->Country->State(if India, Mexico, USA, Canada, & Australia) (No state for other countries) I am...
0
1281
by: Arvi Laanemets | last post by:
Hi We are trying to create a simply ASP code, which creates guests list from Access database, and displays a country flag for every guest. All flag images are stored as *.gif in subfolder Flags. In access database, in a text field, the gif-file name along with relative path is stored (like "Flags/US.gif" or "Flags/Fra.gif"). The ASP code uses an Access query as source, where paths to picture files are represented like "./Flags/US.gif"...
1
1514
Ciary
by: Ciary | last post by:
hi all, new day, and already a new problem (i'm really posting to much questions :-O ) like specified in an earlier question, i'm using an access database in my website. to get it i'm using a DOM-object in php (see code below). this works fine as long as the database doesn't contain tables with spaces in their names. my problem is that my users should be able to select any access database. not only those without spaces. $db = $_GET; ...
0
7996
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
7928
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8415
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8405
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8273
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
5878
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5441
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3903
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
1514
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.