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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
MariaDB
Commits
50561461
Commit
50561461
authored
Jul 09, 2010
by
Mattias Jonsson
Browse files
Options
Browse Files
Download
Plain Diff
merge
parents
72e404be
9edde02e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
0 deletions
+61
-0
sql/ha_partition.cc
sql/ha_partition.cc
+52
-0
sql/ha_partition.h
sql/ha_partition.h
+9
-0
No files found.
sql/ha_partition.cc
View file @
50561461
...
...
@@ -4219,6 +4219,58 @@ int ha_partition::index_read_last_map(uchar *buf, const uchar *key,
}
/*
Optimization of the default implementation to take advantage of dynamic
partition pruning.
*/
int
ha_partition
::
index_read_idx_map
(
uchar
*
buf
,
uint
index
,
const
uchar
*
key
,
key_part_map
keypart_map
,
enum
ha_rkey_function
find_flag
)
{
int
error
=
HA_ERR_KEY_NOT_FOUND
;
DBUG_ENTER
(
"ha_partition::index_read_idx_map"
);
if
(
find_flag
==
HA_READ_KEY_EXACT
)
{
uint
part
;
m_start_key
.
key
=
key
;
m_start_key
.
keypart_map
=
keypart_map
;
m_start_key
.
flag
=
find_flag
;
m_start_key
.
length
=
calculate_key_len
(
table
,
index
,
m_start_key
.
key
,
m_start_key
.
keypart_map
);
get_partition_set
(
table
,
buf
,
index
,
&
m_start_key
,
&
m_part_spec
);
/* How can it be more than one partition with the current use? */
DBUG_ASSERT
(
m_part_spec
.
start_part
==
m_part_spec
.
end_part
);
for
(
part
=
m_part_spec
.
start_part
;
part
<=
m_part_spec
.
end_part
;
part
++
)
{
if
(
bitmap_is_set
(
&
(
m_part_info
->
used_partitions
),
part
))
{
error
=
m_file
[
part
]
->
index_read_idx_map
(
buf
,
index
,
key
,
keypart_map
,
find_flag
);
if
(
error
!=
HA_ERR_KEY_NOT_FOUND
&&
error
!=
HA_ERR_END_OF_FILE
)
break
;
}
}
}
else
{
/*
If not only used with READ_EXACT, we should investigate if possible
to optimize for other find_flag's as well.
*/
DBUG_ASSERT
(
0
);
/* fall back on the default implementation */
error
=
handler
::
index_read_idx_map
(
buf
,
index
,
key
,
keypart_map
,
find_flag
);
}
DBUG_RETURN
(
error
);
}
/*
Read next record in a forward index scan
...
...
sql/ha_partition.h
View file @
50561461
...
...
@@ -448,6 +448,15 @@ class ha_partition :public handler
virtual
int
index_init
(
uint
idx
,
bool
sorted
);
virtual
int
index_end
();
/**
@breif
Positions an index cursor to the index specified in the hanlde. Fetches the
row if available. If the key value is null, begin at first key of the
index.
*/
virtual
int
index_read_idx_map
(
uchar
*
buf
,
uint
index
,
const
uchar
*
key
,
key_part_map
keypart_map
,
enum
ha_rkey_function
find_flag
);
/*
These methods are used to jump to next or previous entry in the index
scan. There are also methods to jump to first and last entry.
...
...
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