Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
02dc7bfb
Commit
02dc7bfb
authored
Oct 23, 2005
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
BUG#9622: post-review-fixes: better comments
parent
71fdef4d
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
30 deletions
+52
-30
include/myisam.h
include/myisam.h
+1
-1
myisam/mi_check.c
myisam/mi_check.c
+32
-22
mysys/my_handler.c
mysys/my_handler.c
+19
-7
No files found.
include/myisam.h
View file @
02dc7bfb
...
...
@@ -323,7 +323,7 @@ typedef enum
MI_STATS_METHOD_NULLS_NOT_EQUAL
,
/* Treat NULLs as equal when collecting statistics (like 4.0 did) */
MI_STATS_METHOD_NULLS_EQUAL
,
/* Ignore NULLs - count
tuples without NULLs only
*/
/* Ignore NULLs - count
only tuples without NULLs in the index components
*/
MI_STATS_METHOD_IGNORE_NULLS
}
enum_mi_stats_method
;
...
...
myisam/mi_check.c
View file @
02dc7bfb
...
...
@@ -603,10 +603,11 @@ void mi_collect_stats_nonulls_first(HA_KEYSEG *keyseg, ulonglong *notnull,
Process the next index tuple:
1. Find out which prefix tuples of last_key don't contain NULLs, and
update the array of notnull counters accordingly.
2. Find the first keypart number where the tuples are different(A), or
last_key has NULL value (B), and return it, so caller can count
number of unique tuples for each key prefix. We don't need (B) to be
counted, and that is compensated back in update_key_parts().
2. Find the first keypart number where the prev_key and last_key tuples
are different(A), or last_key has NULL value(B), and return it, so the
caller can count number of unique tuples for each key prefix. We don't
need (B) to be counted, and that is compensated back in
update_key_parts().
RETURN
1 + number of first keypart where values differ or last_key tuple has NULL
...
...
@@ -619,11 +620,19 @@ int mi_collect_stats_nonulls_next(HA_KEYSEG *keyseg, ulonglong *notnull,
uint
diffs
[
2
];
uint
first_null_seg
,
kp
;
/* Find first keypart where values are different or either of them is NULL */
/*
Find the first keypart where values are different or either of them is
NULL. We get results in diffs array:
diffs[0]= 1 + number of first different keypart
diffs[1]=offset: (last_key + diffs[1]) points to first value in
last_key that is NULL or different from corresponding
value in prev_key.
*/
ha_key_cmp
(
keyseg
,
prev_key
,
last_key
,
USE_WHOLE_KEY
,
SEARCH_FIND
|
SEARCH_NULL_ARE_NOT_EQUAL
|
SEARCH_RETURN_B_POS
,
diffs
);
HA_KEYSEG
*
seg
=
keyseg
+
diffs
[
0
]
-
1
;
/* Find first NULL in last_key */
first_null_seg
=
ha_find_null
(
seg
,
last_key
+
diffs
[
1
])
-
keyseg
;
for
(
kp
=
0
;
kp
<
first_null_seg
;
kp
++
)
...
...
@@ -4096,24 +4105,25 @@ void update_auto_increment_key(MI_CHECK *param, MI_INFO *info,
notnull_tuples IN Array of (#tuples), or NULL
records Number of records in the table
NOTES
DESCRIPTION
This function is called produce index statistics values from unique and
notnull_tuples arrays after these arrays were produced with sequential
index scan (the scan is done in two places: chk_index() and
sort_key_write()).
This function handles all 3 index statistics collection methods.
Unique is an array:
unique[0]= (#different values of {keypart1}) - 1
unique[1]= (#different values of {keypart1,keypart2} tuple) - unique[0] -
1
unique[1]= (#different values of {keypart1,keypart2} tuple)-unique[0]-
1
...
For MI_STATS_METHOD_IGNORE_NULLS notnull_tuples is an array too:
notnull_tuples[0]= (#
of {keypart1} tuples such that keypart1 is not NULL)
notnull_tuples[1]= (#
of {keypart1,keypart2} tuples such that all
For MI_STATS_METHOD_IGNORE_NULLS
method,
notnull_tuples is an array too:
notnull_tuples[0]= (#
of {keypart1} tuples such that keypart1 is not NULL)
notnull_tuples[1]= (#
of {keypart1,keypart2} tuples such that all
keypart{i} are not NULL)
...
For all other statistics collection methods notnull_tuples=NULL.
The 'unique' array is collected in one sequential scan through the entire
index. This is done in two places: in chk_index() and in sort_key_write().
notnull_tuples, if present, is collected during the same index scan.
For all other statistics collection methods notnull_tuples==NULL.
Output is an array:
rec_per_key_part[k] =
...
...
mysys/my_handler.c
View file @
02dc7bfb
...
...
@@ -87,17 +87,29 @@ static int compare_bin(uchar *a, uint a_length, uchar *b, uint b_length,
diff_pos OUT Number of first keypart where values differ, counting
from one.
NOTES
Number-keys can't be splited
DESCRIPTION
If SEARCH_RETURN_B_POS flag is set, diff_pos must point to array of 2
values, first value has the meaning as described above, second value is:
values, first value has the meaning as described in parameter
description above, the second value is:
diff_pos[1] OUT (b + diff_pos[1]) points to first value in tuple b
that is different from corresponding value in tuple a.
EXAMPLES
Example1: if the function is called for tuples
('aaa','bbb') and ('eee','fff'), then
diff_pos[0] = 1 (as 'aaa' != 'eee')
diff_pos[1] = 0 (offset from beggining of tuple b to 'eee' keypart).
Example2: if the index function is called for tuples
('aaa','bbb') and ('aaa','fff'),
diff_pos[0] = 2 (as 'aaa' != 'eee')
diff_pos[1] = 3 (offset from beggining of tuple b to 'fff' keypart,
here we assume that first key part is CHAR(3) NOT NULL)
NOTES
Number-keys can't be splited
RETURN VALUES
<0 If a < b
0 If a == b
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment