473,395 Members | 1,870 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,395 software developers and data experts.

Why a SPILL SORT on *smaller* matchset and not on larger one?

I have a large table (600 Million rows) and Ive been analysing explain plans for queries using this table and noticed that Im getting a SORT(SPILL) and RIDSCN after the Index Scan nearly all the time. I thought this indicated that reading the RIDs was taking up more than the HEAPSIZE memory and so DB2 was spilling the RIDs onto disk. Here is the SQL.

EXPLAIN ALL SET QUERYNO=1 FOR
SELECT
Q1.INTERFACE_REC_ID
FROM MyBigTable Q1
WHERE 1=1
AND Q1.INTERFACE_ID = 57

Both INTERFACE_REC_ID and INTERFACE_ID are in the same index which looks like this:-

+INTERFACE_ID+IND_SUCCESS+INTERFACE_REC_ID

There are 76 potential values INTERFACE_ID can be. Depending on the value of INTERFACE_ID matching rows can be anywhere from 5 to 170 million.

Nothing confusing about that so far I hope. What IS confusing me is that when I change the value of INTERFACE_ID to return 170 million rows (filter factor 4.5%) the SORT(SPILL) and RIDSCN go away, but return for values that return smaller numbers of matching rows. After testing with different INTERFACE_ID values it appears that under 25 million rows returned creates a SORT(SPILL) and RIDSCN, but over that its just an index scan and fetch.

Why a spill on smaller cardinality matches instead of bigger ones? I would have thought less matches found would fit into a memory and bigger ones would spill onto disk, not the other way around!
Feb 15 '11 #1
0 1302

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: gino | last post by:
Dear all, My monitor was set to 1600x1200 so the fonts in IE is too small for me even when I set the "View->Text Size->Largest"... I don't have previlage to change the monitor resolution... ...
9
by: JasBascom | last post by:
say i had 97456 and 23456 is there already a sort function to check which one begins with the smaller number rearrange it. in this case the bottom number should clearly be rearranged to the...
12
by: Eva | last post by:
Hi, I try to implement quick sort. I sort vectors by their first value. 10 2 3 4 9 3 5 6 10 4 5 6 must be 9 3 5 6 10 2 3 4 10 4 5 6 The prog works great on maybe 500 vectors, but I have an...
20
by: Xah Lee | last post by:
Sort a List Xah Lee, 200510 In this page, we show how to sort a list in Python & Perl and also discuss some math of sort. To sort a list in Python, use the “sort” method. For example: ...
22
by: petermichaux | last post by:
Hi, I'm curious about server load and download time if I use one big javascript file or break it into several smaller ones. Which is better? (Please think of this as the first time the scripts...
0
by: JosAH | last post by:
Greetings, I was asked to write a Tip Of the Week; so here goes: a lot of topics are started here in this forum (and a lot of other forums too) mentioning a problem about sorting data. ...
2
by: mqueene7 | last post by:
below is my code for my merge sort but I can't get it to sort properly. I am trying generate random numbers based on input from the user and then sort those random numbers. Can you tell me what I...
4
by: mqueene7 | last post by:
below is my code - i can get the numbers to generate but they will not sort. i need to use the merge sort method for sorting. i also need to make this array size whatever the user wants - but it...
3
by: Brian | last post by:
I have a windows forms project done in vb.net. One of the forms creates graphs based on the data supplied to it. I want to take multiple graphs and paste them into a larger Image object. I...
1
by: Steven Clark | last post by:
If I have a list of items of mixed type, can I put something into it such that after a list.sort(), is guaranteed to be at the end of the list? Looking at...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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
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...
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
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...
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 projectplanning, 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.