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
9369764f
Commit
9369764f
authored
Jan 30, 2002
by
unknown
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Take into account that table scans may use indexes
Docs/manual.texi: Changelog
parent
9c5eec61
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
7 deletions
+22
-7
Docs/manual.texi
Docs/manual.texi
+3
-0
sql/ha_berkeley.h
sql/ha_berkeley.h
+1
-1
sql/ha_innodb.h
sql/ha_innodb.h
+2
-1
sql/handler.h
sql/handler.h
+8
-4
sql/sql_select.cc
sql/sql_select.cc
+8
-1
No files found.
Docs/manual.texi
View file @
9369764f
...
@@ -48374,6 +48374,9 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
...
@@ -48374,6 +48374,9 @@ Our TODO section contains what we plan to have in 4.0. @xref{TODO MySQL 4.0}.
@itemize @bullet
@itemize @bullet
@item
@item
Don't use table scan with BerkeleyDB and InnoDB tables when we can use
an index that covers the whole row.
@item
Added sql-mode flag @code{NO_UNSIGNED_SUBTRACTION} to disable unsigned
Added sql-mode flag @code{NO_UNSIGNED_SUBTRACTION} to disable unsigned
arithmetic rules when it comes to subtraction. (This will make MySQL 4.0
arithmetic rules when it comes to subtraction. (This will make MySQL 4.0
behave more closely to 3.23 with @code{UNSIGNED} columns).
behave more closely to 3.23 with @code{UNSIGNED} columns).
sql/ha_berkeley.h
View file @
9369764f
...
@@ -92,7 +92,7 @@ class ha_berkeley: public handler
...
@@ -92,7 +92,7 @@ class ha_berkeley: public handler
HA_NULL_KEY
|
HA_HAVE_KEY_READ_ONLY
|
HA_NULL_KEY
|
HA_HAVE_KEY_READ_ONLY
|
HA_BLOB_KEY
|
HA_NOT_EXACT_COUNT
|
HA_BLOB_KEY
|
HA_NOT_EXACT_COUNT
|
HA_PRIMARY_KEY_IN_READ_INDEX
|
HA_DROP_BEFORE_CREATE
|
HA_PRIMARY_KEY_IN_READ_INDEX
|
HA_DROP_BEFORE_CREATE
|
HA_AUTO_PART_KEY
),
HA_AUTO_PART_KEY
|
HA_TABLE_SCAN_ON_INDEX
),
changed_rows
(
0
),
last_dup_key
((
uint
)
-
1
),
version
(
0
),
using_ignore
(
0
)
changed_rows
(
0
),
last_dup_key
((
uint
)
-
1
),
version
(
0
),
using_ignore
(
0
)
{
{
}
}
...
...
sql/ha_innodb.h
View file @
9369764f
...
@@ -84,7 +84,8 @@ class ha_innobase: public handler
...
@@ -84,7 +84,8 @@ class ha_innobase: public handler
HA_NO_WRITE_DELAYED
|
HA_NO_WRITE_DELAYED
|
HA_PRIMARY_KEY_IN_READ_INDEX
|
HA_PRIMARY_KEY_IN_READ_INDEX
|
HA_DROP_BEFORE_CREATE
|
HA_NOT_READ_PREFIX_LAST
|
HA_DROP_BEFORE_CREATE
|
HA_NOT_READ_PREFIX_LAST
|
HA_NO_PREFIX_CHAR_KEYS
),
HA_NO_PREFIX_CHAR_KEYS
|
HA_TABLE_SCAN_ON_INDEX
),
last_dup_key
((
uint
)
-
1
),
last_dup_key
((
uint
)
-
1
),
start_of_scan
(
0
)
start_of_scan
(
0
)
{
{
...
...
sql/handler.h
View file @
9369764f
...
@@ -42,16 +42,13 @@
...
@@ -42,16 +42,13 @@
#define HA_ADMIN_INVALID -5
#define HA_ADMIN_INVALID -5
/* Bits in bas_flag to show what database can do */
/* Bits in bas_flag to show what database can do */
#define HA_READ_NEXT 1
/* Read next record with same key */
#define HA_READ_NEXT 1
/* Read next record with same key */
#define HA_READ_PREV 2
/* Read prev. record with same key */
#define HA_READ_PREV 2
/* Read prev. record with same key */
#define HA_READ_ORDER 4
/* Read through record-keys in order */
#define HA_READ_ORDER 4
/* Read through record-keys in order */
#define HA_READ_RND_SAME 8
/* Read RND-record to KEY-record
#define HA_READ_RND_SAME 8
/* Read RND-record to KEY-record
(To update with RND-read) */
(To update with RND-read) */
#define HA_KEYPOS_TO_RNDPOS 16
/* ha_info gives pos to record */
#define HA_KEYPOS_TO_RNDPOS 16
/* ha_info gives pos to record */
#define HA_LASTKEY_ORDER 32
/* Next record gives next record
#define HA_TABLE_SCAN_ON_INDEX 32
/* No separate data/index file */
according last record read (even
if database is updated after read) */
#define HA_REC_NOT_IN_SEQ 64
/* ha_info don't return recnumber;
#define HA_REC_NOT_IN_SEQ 64
/* ha_info don't return recnumber;
It returns a position to ha_r_rnd */
It returns a position to ha_r_rnd */
#define HA_ONLY_WHOLE_INDEX 128
/* Can't use part key searches */
#define HA_ONLY_WHOLE_INDEX 128
/* Can't use part key searches */
...
@@ -78,6 +75,13 @@
...
@@ -78,6 +75,13 @@
#define HA_CAN_FULLTEXT (HA_NO_PREFIX_CHAR_KEYS*2)
#define HA_CAN_FULLTEXT (HA_NO_PREFIX_CHAR_KEYS*2)
#define HA_CAN_SQL_HANDLER (HA_CAN_FULLTEXT*2)
#define HA_CAN_SQL_HANDLER (HA_CAN_FULLTEXT*2)
/* Old not used flags */
/*
Next record gives next record according last record read (even
if database is updated after read)
*/
#define HA_LASTKEY_ORDER 0
/* Parameters for open() (in register form->filestat) */
/* Parameters for open() (in register form->filestat) */
/* HA_GET_INFO does an implicit HA_ABORT_IF_LOCKED */
/* HA_GET_INFO does an implicit HA_ABORT_IF_LOCKED */
...
...
sql/sql_select.cc
View file @
9369764f
...
@@ -1939,10 +1939,17 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
...
@@ -1939,10 +1939,17 @@ find_best(JOIN *join,table_map rest_tables,uint idx,double record_count,
/*
/*
Don't test table scan if it can't be better.
Don't test table scan if it can't be better.
Prefer key lookup if we would use the same key for scanning.
Prefer key lookup if we would use the same key for scanning.
Don't do a table scan on InnoDB tables, if we can read the used
parts of the row from any of the used index.
This is because table scans uses index and we would not win
anything by using a table scan.
*/
*/
if
((
records
>=
s
->
found_records
||
best
>
s
->
read_time
)
&&
if
((
records
>=
s
->
found_records
||
best
>
s
->
read_time
)
&&
!
(
s
->
quick
&&
best_key
&&
s
->
quick
->
index
==
best_key
->
key
&&
!
(
s
->
quick
&&
best_key
&&
s
->
quick
->
index
==
best_key
->
key
&&
best_max_key_part
>=
s
->
table
->
quick_key_parts
[
best_key
->
key
]))
best_max_key_part
>=
s
->
table
->
quick_key_parts
[
best_key
->
key
])
&&
!
((
s
->
table
->
file
->
option_flag
()
&
HA_TABLE_SCAN_ON_INDEX
)
&&
s
->
table
->
used_keys
&&
best_key
))
{
// Check full join
{
// Check full join
if
(
s
->
on_expr
)
if
(
s
->
on_expr
)
{
{
...
...
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