473,811 Members | 2,685 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

rows read vs. rows selected.

Hi All:

I have a query which is running against large table. The query:

SELECT DSRC_ACCT_ID, ADDR1, ADDR2, ADDR3, CITY, STATE, POSTAL_CODE,
COUNT(*) FROM ERD.ADDRESSA GROUP BY DSRC_ACCT_ID, ADDR1, ADDR2, ADDR3,
CITY, STATE, POSTAL_CODE HAVING COUNT(*) > 2

The applcation snapshot monitor shows:
Rows selected = 181
Rows read = 646485498
Rows written = 933743357
The rows read is too high compared to rows selected.
(The table has 933743360 rows)

My questions is: What's the best way to increase selectivity of this
query?
Thanks in Advance.

Vijay
The plan is using the correct index:

RETURN
( 1)
|
FILTER
( 2)
|
GRPBY
( 3)
|
TBSCAN
( 4)
|
SORT
( 5)
|
IXSCAN
( 6)
/ \
Index: Table:
ERD ERD
ADDR_QRYA ADDRESSA

Nov 12 '05 #1
3 5881
"UDBDBA" <vi***********@ gmail.com> wrote in message
news:11******** **************@ g49g2000cwa.goo glegroups.com.. .
Hi All:

I have a query which is running against large table. The query:

SELECT DSRC_ACCT_ID, ADDR1, ADDR2, ADDR3, CITY, STATE, POSTAL_CODE,
COUNT(*) FROM ERD.ADDRESSA GROUP BY DSRC_ACCT_ID, ADDR1, ADDR2, ADDR3,
CITY, STATE, POSTAL_CODE HAVING COUNT(*) > 2

The applcation snapshot monitor shows:
Rows selected = 181
Rows read = 646 485 498
Rows written = 933 743 357
The rows read is too high compared to rows selected.
(The table has 933 743 360 rows)

My questions is: What's the best way to increase selectivity of this
query?
Thanks in Advance.

Vijay

If you want to increase selectivity, you need to use a WHERE clause before
the group by. If you want to evaluate every row, then you cannot do that.

I don't think that the snapshot monitor data you are looking at is telling
you what you think it is.

The best way to improve the performance on a table scan on a very large
table is to use multiple containers (on separate physical devices) and to
enable intra-partition parallelism. Make sure your prefetch size is n times
your extent size of the tablespace (where n is the number of containers).
You could also consider splitting the data into multiple tables and using a
UNION ALL view, which would also enable parallelism. The degree of
parallelism you want depends on the number of CPUs and separate physical
disk devices you have.

You should also look sort heaps, temporary tablespaces, and make sure they
are large enough.

If your application does mostly table scans (data warehouse application),
increase your tablespace page size to 16K or 32K (this will hurt your OLTP
transactions if you have any).
Nov 12 '05 #2
UDBDBA wrote:
Hi All:

I have a query which is running against large table. The query:

SELECT DSRC_ACCT_ID, ADDR1, ADDR2, ADDR3, CITY, STATE, POSTAL_CODE,
COUNT(*) FROM ERD.ADDRESSA GROUP BY DSRC_ACCT_ID, ADDR1, ADDR2, ADDR3,
CITY, STATE, POSTAL_CODE HAVING COUNT(*) > 2

The applcation snapshot monitor shows:
Rows selected = 181
Rows read = 646485498
Rows written = 933743357
The rows read is too high compared to rows selected.
(The table has 933743360 rows)

My questions is: What's the best way to increase selectivity of this
query?
Thanks in Advance.

Vijay
The plan is using the correct index:

RETURN
( 1)
|
FILTER
( 2)
|
GRPBY
( 3)
|
TBSCAN
( 4)
|
SORT
( 5)
|
IXSCAN
( 6)
/ \
Index: Table:
ERD ERD
ADDR_QRYA ADDRESSA

What's the ADDR_QRYA index defined on?
Do you ahve an index on your group by columns (in that order!):
(DSRC_ACCT_ID, ADDR1, ADDR2, ADDR3, CITY, STATE, POSTAL_CODE)
Reason why I'm asking is that the SORT should go (do you have sort
overflows? (rows written...??).

A totally different approach could be to employ an MQT.

Cheers
Serge
--
Serge Rielau
DB2 SQL Compiler Development
IBM Toronto Lab
Nov 12 '05 #3
The index definition:
create UNIQUE index addr_qrya on erd.addressa (DSRC_ACCT_ID,A DDR_ID)
INCLUDE (ADDR1,ADDR2, ADDR3, CITY, STATE, POSTAL_CODE) ALLOW REVERSE
SCANS;

The access graph shows an index only access, but the SORT and TBSCAN in
access graph .. can you explain it?

We evaluated MQT vs. Adding an extra index with INCLUDE columns. Seems
like this index could be used by other queries and saves us the
overhead of double the operation (update,insert. logging,locking ...) by
having MQT.

Thanks!
Vijay

Nov 12 '05 #4

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

Similar topics

5
14744
by: Mojtaba Faridzad | last post by:
Hi, with SetDataBinding( ) a DataGrid shows a DataView. user can select some rows in the grid by holding cotrol key. when user clicks on Delete button, I should delete all selected rows. I am trying to delete these lines from the dataview like this: for (int i=0; i < dataView.Count; i++) if (dataGrid.IsSelected(i)) dataView.Delete(i);
3
4439
by: BBFrost | last post by:
Ok, I know how to count the number of selected datagrid rows using the code below. What has me stumped is how to determine when the selected rows within a datagrid have been changed. The DataGrid object doesn't seem to have a any type of a selection changed type of event I can grab. THE QUESTION: Does anyone know how to determine when the selected row or set of rows within a datagrid has changed ??? This is driving me nuts !
5
9181
by: BBFrost | last post by:
Win2000 ..Net 1.1 SP1 c# using Visual Studio Ok, I'm currently in a "knock down - drag out" tussle with the .Net 1.1 datagrid. I've come to realize that a 'block' of rows highlighted within a datagrid do >> not << constitute a set of 'selected' records. Apparently one and only one row may be 'selected' in a datagrid. By selected row I mean the row
1
1941
by: Alex K. | last post by:
I need to be able to jump to first selected row in DataGrid. How can I do this without using IsSelected for each row? Is there some sort of collection which contains all selected rows? Thank you.
1
4569
by: Jon | last post by:
Question: does datagrid1.isSelected(i) point to the same row as datatable.row(i).delete after datagrid sorted?? I am using datagrid1.isSelected(i) to identify datatable rows that have been selected by the user Then I use datatable.rows(i).delete to delete those rows. It works fine if I have not sorted the datatable first. But if
2
23963
by: Ettenurb | last post by:
I was hoping someone has come across this and came up with a solution. We have upgraded our custom software to us Infragistics UltraWinGrid 2006 CLR 2.0. The code below worked with a previous release of the UltraWinGrid. When the user clicks on the 'Select All' button this code is selecting all rows in the grid. The grid has band(0) and band(1) (Parent and multiple children)
0
1216
by: Tim Kelley | last post by:
I have a dataviewgrid in my project which the user will select multiple rows. They will click a button and my program will perform some operation on the selected rows. My question is, how do I reference the data in the selected rows. I can get the number of selected rows, but I don't know how to reference the data in the selected rows. Thanks,
3
14439
by: dianaj86 | last post by:
I have multiple dropdownlists each one filled with values from a specific column in the table. Also I have multiple textboxes corresponding to dropdownlists. For example, when I select an item from dropdownlistA, all the textboxes are filled with the first row values that contains that selected item and gives the number of rows containing this value……. In addition, I have 2 buttons one is Move Forward Button and the other is Move Previous…I am...
11
2545
by: patsman77 | last post by:
Hello All, I am having a frustrating time trying to figure this out. I have a form, in which I want to have fields WEEK, ID, FAVORITE, UNDERDOG, SPREAD, FSCORE, USCORE, and TIME. The form is to have 16 rows to be entered at one time, instead of entering 1 at a time. I can get it to 1 record at a time easily enough. How do you get all 20 to update or insert? Do you have to use an array in this situation? The FAVORITE and UNDERDOG fields...
0
10647
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
10386
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...
1
10398
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9204
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7669
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
6889
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();...
1
4339
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3865
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3017
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.