473,396 Members | 2,011 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,396 software developers and data experts.

view with where condition

hi, we are using db2 udb v8.1 on windows, i have a table contains over
one million records, it has seperate own tablespace than others, with
bufferpool size 250, i have created multiple views on this table , the
problem is some of the views have omit infomation like this one :
where ( not (OECD09='A')) and ( not ( OECD09='K')) and ( not (
OECD09='C')) and ( not ( OECD09='G')) and ( not ( OECD09='S')) and
( not ( OEQY02=+0)) and ( not ( OECD47='C')) and ( not (
OECD47='V')) and ( not ( OECD04='N')) and ( not ( OECD01='D')), so
even though the view with the where condition has zero records, it
takes me a 2,3 minutes to come up when i do sample data, so my
question is is there anyway come up the query faster? is the db2
determine the data based on the where condition on the run time?
thanks
Nov 12 '05 #1
8 3567
Ian
xixi wrote:
hi, we are using db2 udb v8.1 on windows, i have a table contains over
one million records, it has seperate own tablespace than others, with
bufferpool size 250, i have created multiple views on this table , the
problem is some of the views have omit infomation like this one :
where ( not (OECD09='A')) and ( not ( OECD09='K')) and ( not (
OECD09='C')) and ( not ( OECD09='G')) and ( not ( OECD09='S')) and
( not ( OEQY02=+0)) and ( not ( OECD47='C')) and ( not (
OECD47='V')) and ( not ( OECD04='N')) and ( not ( OECD01='D')), so
even though the view with the where condition has zero records, it
takes me a 2,3 minutes to come up when i do sample data, so my
question is is there anyway come up the query faster? is the db2
determine the data based on the where condition on the run time?
thanks

Views are not materialized, so each query to the view gets materialized
at runtime. You can pre-compute the results by building a materialized
query table (MQT).

A couple of other notes:

You can rewrite your predicate to simplify:

where OECD09 not in ('A','K','C','G','S')
and OECD47 not in ('C','V')
and OECD40 <> 'N'
and OECD01 <> 'D'
and OEQY02 <> 0

If this is is performing poorly, consider your index design, statistics,
etc.


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 12 '05 #2
Ian
xixi wrote:
hi, we are using db2 udb v8.1 on windows, i have a table contains over
one million records, it has seperate own tablespace than others, with
bufferpool size 250, i have created multiple views on this table , the
problem is some of the views have omit infomation like this one :
where ( not (OECD09='A')) and ( not ( OECD09='K')) and ( not (
OECD09='C')) and ( not ( OECD09='G')) and ( not ( OECD09='S')) and
( not ( OEQY02=+0)) and ( not ( OECD47='C')) and ( not (
OECD47='V')) and ( not ( OECD04='N')) and ( not ( OECD01='D')), so
even though the view with the where condition has zero records, it
takes me a 2,3 minutes to come up when i do sample data, so my
question is is there anyway come up the query faster? is the db2
determine the data based on the where condition on the run time?
thanks

Views are not materialized, so each query to the view gets materialized
at runtime. You can pre-compute the results by building a materialized
query table (MQT).

A couple of other notes:

You can rewrite your predicate to simplify:

where OECD09 not in ('A','K','C','G','S')
and OECD47 not in ('C','V')
and OECD40 <> 'N'
and OECD01 <> 'D'
and OEQY02 <> 0

If this is is performing poorly, consider your index design, statistics,
etc.


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Nov 12 '05 #3
xixi wrote:
hi, we are using db2 udb v8.1 on windows, i have a table contains over
one million records, it has seperate own tablespace than others, with
bufferpool size 250, i have created multiple views on this table , the
problem is some of the views have omit infomation like this one :
where ( not (OECD09='A')) and ( not ( OECD09='K')) and ( not (
OECD09='C')) and ( not ( OECD09='G')) and ( not ( OECD09='S')) and
( not ( OEQY02=+0)) and ( not ( OECD47='C')) and ( not (
OECD47='V')) and ( not ( OECD04='N')) and ( not ( OECD01='D')), so
even though the view with the where condition has zero records, it
takes me a 2,3 minutes to come up when i do sample data, so my
question is is there anyway come up the query faster? is the db2
determine the data based on the where condition on the run time?
thanks


Do you have indexes on the OECDxx colums?

You could also try to rephrase the WHERE clause like this:

WHERE oecd09 NOT IN ( 'A', 'K', 'C', 'G', 'S' ) AND
oeqy <> 0 AND
oecd47 NOT IN ( 'C', 'V' ) AND
oecd04 <> 'N' AND
oecd01 <> 'D'

--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Nov 12 '05 #4
xixi wrote:
hi, we are using db2 udb v8.1 on windows, i have a table contains over
one million records, it has seperate own tablespace than others, with
bufferpool size 250, i have created multiple views on this table , the
problem is some of the views have omit infomation like this one :
where ( not (OECD09='A')) and ( not ( OECD09='K')) and ( not (
OECD09='C')) and ( not ( OECD09='G')) and ( not ( OECD09='S')) and
( not ( OEQY02=+0)) and ( not ( OECD47='C')) and ( not (
OECD47='V')) and ( not ( OECD04='N')) and ( not ( OECD01='D')), so
even though the view with the where condition has zero records, it
takes me a 2,3 minutes to come up when i do sample data, so my
question is is there anyway come up the query faster? is the db2
determine the data based on the where condition on the run time?
thanks


Do you have indexes on the OECDxx colums?

You could also try to rephrase the WHERE clause like this:

WHERE oecd09 NOT IN ( 'A', 'K', 'C', 'G', 'S' ) AND
oeqy <> 0 AND
oecd47 NOT IN ( 'C', 'V' ) AND
oecd04 <> 'N' AND
oecd01 <> 'D'

--
Knut Stolze
Information Integration
IBM Germany / University of Jena
Nov 12 '05 #5
the where clause is automatically generated by program, i can't change
that to you described, unless manually, i have done indexes suggested
by db2 already, and do run statistics too.
Nov 12 '05 #6
the where clause is automatically generated by program, i can't change
that to you described, unless manually, i have done indexes suggested
by db2 already, and do run statistics too.
Nov 12 '05 #7
i have tried to change the where clause as you described, run stat,
and create the index as db2 design advisor recommend, but still not
much improvment on the query from the view, anything else could help?
thanks


Views are not materialized, so each query to the view gets materialized
at runtime. You can pre-compute the results by building a materialized
query table (MQT).

A couple of other notes:

You can rewrite your predicate to simplify:

where OECD09 not in ('A','K','C','G','S')
and OECD47 not in ('C','V')
and OECD40 <> 'N'
and OECD01 <> 'D'
and OEQY02 <> 0

If this is is performing poorly, consider your index design, statistics,
etc.


-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----

Nov 12 '05 #8
"xixi" <da****@yahoo.com> wrote in message
news:c0**************************@posting.google.c om...
i have tried to change the where clause as you described, run stat,
and create the index as db2 design advisor recommend, but still not
much improvment on the query from the view, anything else could help?
thanks


Views are not materialized, so each query to the view gets materialized
at runtime. You can pre-compute the results by building a materialized
query table (MQT).

A couple of other notes:

You can rewrite your predicate to simplify:

where OECD09 not in ('A','K','C','G','S')
and OECD47 not in ('C','V')
and OECD40 <> 'N'
and OECD01 <> 'D'
and OEQY02 <> 0

If this is is performing poorly, consider your index design, statistics,
etc.

Please show the index DDL for all the indexes on the table(s) in the query.
Nov 12 '05 #9

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

Similar topics

1
by: js | last post by:
I am trying to create a primary key constraint on a view in the following statement. However, I got an error ORA-00907: missing right parenthesis. If the CONSTRAINT clause is removed, then the...
4
by: sci | last post by:
Could someone help me by answering the questions below? What's a cursor? What's difference between Query and View? Is a RecordSet just part of a table? Can it be part of a query of view? If...
3
by: brendan_gallagher_2001 | last post by:
Hi, I have a view(A) and I am trying to do a join on another table (B) to include only rows where date values in view A is greater than in table B. I also want the view to pick up rows in viewA...
0
by: xixi | last post by:
hi, we are using db2 udb v8.1 on windows, i have a table contains over one million records, it has seperate own tablespace than others, with bufferpool size 250, i have created multiple views on...
8
by: xixi | last post by:
when i create a join view like this create view JV104FZ.APJTINM1 (APAM32, APNO20, APQY05, PONO01, PONO05, PONO19, POCD01, POCD13, systimestamp, loginname, id ) as select JV104FZ.APPTINM.APAM32,...
2
by: Sathyaram Sannasi | last post by:
I'm testing a UNION ALL View (say UA_VIEW) of 12 tables - one table for each year - 5 million records/table on an average. Check constraints are defined on the base table - EG. EFF_START_DATE...
1
by: sasan3 | last post by:
when I set visible=false, then entry is not visible in form view, but still shows up in datasheet view. How do I make a field not to show based on some condition in datasheet view? Tx.
6
by: Bethany Holliday | last post by:
Hi All, I'm hoping someone can help me. I think I'm missing something very basic. I'm trying to put a clustered index on a view that I have created. I keep getting the error: Server: Msg...
4
by: JayCallas | last post by:
I have a SQL 2000 table containing 2 million rows of Trade data. Here are some of the columns: INT IDENTITY(1,1) -- PK, non-clustered DATETIME -- clustered index ...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.