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
8685094e
Commit
8685094e
authored
May 23, 2001
by
monty@tik.mysql.fi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't write rows in MyISAM tables when using count(distinct)
Don't read MyISAM header when running without locking
parent
a3be64bf
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
87 additions
and
39 deletions
+87
-39
BitKeeper/etc/logging_ok
BitKeeper/etc/logging_ok
+1
-0
include/myisam.h
include/myisam.h
+1
-1
myisam/mi_locking.c
myisam/mi_locking.c
+8
-5
myisam/mi_open.c
myisam/mi_open.c
+8
-5
myisam/mi_static.c
myisam/mi_static.c
+1
-1
mysql-test/r/select_found.result
mysql-test/r/select_found.result
+31
-0
mysql-test/t/select_found.test
mysql-test/t/select_found.test
+20
-0
sql/item_sum.cc
sql/item_sum.cc
+1
-0
sql/mysqld.cc
sql/mysqld.cc
+5
-20
sql/sql_analyse.h
sql/sql_analyse.h
+0
-2
sql/sql_select.cc
sql/sql_select.cc
+9
-3
sql/sql_select.h
sql/sql_select.h
+1
-1
sql/table.h
sql/table.h
+1
-1
No files found.
BitKeeper/etc/logging_ok
View file @
8685094e
...
...
@@ -11,3 +11,4 @@ sasha@mysql.sashanet.com
serg@serg.mysql.com
tim@threads.polyesthetic.msg
tim@work.mysql.com
monty@tik.mysql.fi
include/myisam.h
View file @
8685094e
...
...
@@ -187,7 +187,7 @@ typedef struct st_columndef /* column information */
extern
my_string
myisam_log_filename
;
/* Name of logfile */
extern
uint
myisam_block_size
;
extern
my_bool
myisam_flush
,
myisam_delay_key_write
;
extern
my_bool
myisam_flush
,
myisam_delay_key_write
,
myisam_single_user
;
extern
my_bool
myisam_concurrent_insert
;
extern
my_off_t
myisam_max_temp_length
,
myisam_max_extra_temp_length
;
...
...
myisam/mi_locking.c
View file @
8685094e
...
...
@@ -412,11 +412,14 @@ int _mi_mark_file_changed(MI_INFO *info)
share
->
global_changed
=
1
;
share
->
state
.
open_count
++
;
}
mi_int2store
(
buff
,
share
->
state
.
open_count
);
buff
[
2
]
=
1
;
/* Mark that it's changed */
return
(
my_pwrite
(
share
->
kfile
,
buff
,
sizeof
(
buff
),
sizeof
(
share
->
state
.
header
),
MYF
(
MY_NABP
)));
if
(
!
share
->
temporary
)
{
mi_int2store
(
buff
,
share
->
state
.
open_count
);
buff
[
2
]
=
1
;
/* Mark that it's changed */
return
(
my_pwrite
(
share
->
kfile
,
buff
,
sizeof
(
buff
),
sizeof
(
share
->
state
.
header
),
MYF
(
MY_NABP
)));
}
}
return
0
;
}
...
...
myisam/mi_open.c
View file @
8685094e
...
...
@@ -777,14 +777,17 @@ uint mi_state_info_read_dsk(File file, MI_STATE_INFO *state, my_bool pRead)
{
char
buff
[
MI_STATE_INFO_SIZE
+
MI_STATE_EXTRA_SIZE
];
if
(
pRead
)
if
(
!
myisam_single_user
)
{
if
(
my_pread
(
file
,
buff
,
state
->
state_length
,
0L
,
MYF
(
MY_NABP
)))
if
(
pRead
)
{
if
(
my_pread
(
file
,
buff
,
state
->
state_length
,
0L
,
MYF
(
MY_NABP
)))
return
(
MY_FILE_ERROR
);
}
else
if
(
my_read
(
file
,
buff
,
state
->
state_length
,
MYF
(
MY_NABP
)))
return
(
MY_FILE_ERROR
);
mi_state_info_read
(
buff
,
state
);
}
else
if
(
my_read
(
file
,
buff
,
state
->
state_length
,
MYF
(
MY_NABP
)))
return
(
MY_FILE_ERROR
);
mi_state_info_read
(
buff
,
state
);
return
0
;
}
...
...
myisam/mi_static.c
View file @
8685094e
...
...
@@ -32,7 +32,7 @@ my_string myisam_log_filename=(char*) "myisam.log";
File
myisam_log_file
=
-
1
;
uint
myisam_quick_table_bits
=
9
;
uint
myisam_block_size
=
MI_KEY_BLOCK_LENGTH
;
/* Best by test */
my_bool
myisam_flush
=
0
,
myisam_delay_key_write
=
0
;
my_bool
myisam_flush
=
0
,
myisam_delay_key_write
=
0
,
myisam_single_user
=
0
;
#if defined(THREAD) && !defined(DONT_USE_RW_LOCKS)
my_bool
myisam_concurrent_insert
=
1
;
#else
...
...
mysql-test/r/select_found.result
0 → 100644
View file @
8685094e
a b
1 2
2 3
3 5
4 5
5 5
6 6
7 7
8 9
FOUND_ROWS()
8
a b
1 2
FOUND_ROWS()
8
a b
8 9
FOUND_ROWS()
8
b
2
FOUND_ROWS()
6
b c
2 1
FOUND_ROWS()
6
a b a b
3 5 5 5
FOUND_ROWS()
8
mysql-test/t/select_found.test
0 → 100644
View file @
8685094e
#
# Testing of found_rows()
#
drop
table
if
exists
t1
;
create
table
t1
(
a
int
not
null
auto_increment
,
b
int
not
null
,
primary
key
(
a
));
insert
into
t1
(
b
)
values
(
2
),(
3
),(
5
),(
5
),(
5
),(
6
),(
7
),(
9
);
select
SQL_CALC_FOUND_ROWS
*
from
t1
;
select
found_rows
();
select
SQL_CALC_FOUND_ROWS
*
from
t1
limit
1
;
select
found_rows
();
select
SQL_CALC_FOUND_ROWS
*
from
t1
order
by
b
desc
limit
1
;
select
found_rows
();
select
SQL_CALC_FOUND_ROWS
distinct
b
from
t1
limit
1
;
select
found_rows
();
select
SQL_CALC_FOUND_ROWS
b
,
count
(
*
)
as
c
from
t1
group
by
b
order
by
c
limit
1
;
select
found_rows
();
select
SQL_CALC_FOUND_ROWS
*
from
t1
left
join
t1
as
t2
on
(
t1
.
b
=
t2
.
a
)
limit
2
,
1
;
select
found_rows
();
drop
table
t1
;
sql/item_sum.cc
View file @
8685094e
...
...
@@ -867,6 +867,7 @@ bool Item_sum_count_distinct::setup(THD *thd)
0
,
0
,
current_lex
->
options
|
thd
->
options
)))
return
1
;
table
->
file
->
extra
(
HA_EXTRA_NO_ROWS
);
// Don't update rows
table
->
no_rows
=
1
;
if
(
table
->
db_type
==
DB_TYPE_HEAP
)
// no blobs, otherwise it would be
// MyISAM
...
...
sql/mysqld.cc
View file @
8685094e
...
...
@@ -3028,14 +3028,13 @@ static void usage(void)
puts
(
"\
-O, --set-variable var=option
\n
\
Give a variable an value. --help lists variables
\n
\
-Sg, --skip-grant-tables
\n
\
Start without grant tables. This gives all users
\n
\
FULL ACCESS to all tables!
\n
\
--safe-mode Skip some optimize stages (for testing)
\n
\
--skip-concurrent-insert
\n
\
Don't use concurrent insert with MyISAM
\n
\
--skip-delay-key-write
\n
\
Ignore the delay_key_write option for all tables
\n
\
--skip-grant-tables Start without grant tables. This gives all users
\n
\
FULL ACCESS to all tables!
\n
\
--skip-host-cache Don't cache host names
\n
\
--skip-locking Don't use system locking. To use isamchk one has
\n
\
to shut down the server.
\n
\
...
...
@@ -3172,7 +3171,7 @@ static void set_options(void)
#endif
#if defined( HAVE_mit_thread ) || defined( __WIN__ ) || defined( HAVE_LINUXTHREADS )
my_disable_locking
=
1
;
my_disable_locking
=
myisam_single_user
=
1
;
#endif
my_bind_addr
=
htonl
(
INADDR_ANY
);
}
...
...
@@ -3265,20 +3264,6 @@ static void get_options(int argc,char **argv)
test_flags
=
optarg
?
(
uint
)
atoi
(
optarg
)
:
0
;
opt_endinfo
=
1
;
break
;
case
'S'
:
if
(
!
optarg
)
opt_specialflag
|=
SPECIAL_NO_NEW_FUNC
|
SPECIAL_SAFE_MODE
;
else
if
(
!
strcmp
(
optarg
,
"l"
))
my_disable_locking
=
1
;
else
if
(
!
strcmp
(
optarg
,
"g"
))
opt_noacl
=
1
;
else
{
fprintf
(
stderr
,
"%s: Unrecognized option: %s
\n
"
,
my_progname
,
optarg
);
use_help
();
exit
(
1
);
}
break
;
case
(
int
)
OPT_BIG_TABLES
:
thd_startup_options
|=
OPTION_BIG_TABLES
;
break
;
...
...
@@ -3456,7 +3441,7 @@ static void get_options(int argc,char **argv)
opt_noacl
=
1
;
break
;
case
(
int
)
OPT_SKIP_LOCK
:
my_disable_locking
=
1
;
my_disable_locking
=
myisam_single_user
=
1
;
break
;
case
(
int
)
OPT_SKIP_HOST_CACHE
:
opt_specialflag
|=
SPECIAL_NO_HOST_CACHE
;
...
...
@@ -4022,7 +4007,7 @@ static int get_service_parameters()
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"KeyBufferSize"
))
==
0
)
{
SET_CHANGEABLE_VARVAL
(
"key_buffer"
);
SET_CHANGEABLE_VARVAL
(
"key_buffer
_size
"
);
}
else
if
(
lstrcmp
(
szKeyValueName
,
TEXT
(
"LongQueryTime"
))
==
0
)
{
...
...
sql/sql_analyse.h
View file @
8685094e
...
...
@@ -21,8 +21,6 @@
#pragma interface
/* gcc class implementation */
#endif
#include <my_tree.h>
#define DEC_IN_AVG 4
typedef
struct
st_number_info
...
...
sql/sql_select.cc
View file @
8685094e
...
...
@@ -69,7 +69,7 @@ static COND *remove_eq_conds(COND *cond,Item::cond_result *cond_value);
static
bool
const_expression_in_where
(
COND
*
conds
,
Item
*
item
,
Item
**
comp_item
);
static
bool
open_tmp_table
(
TABLE
*
table
);
static
bool
create_myisam_tmp_table
(
TABLE
*
table
,
TMP_TABLE_PARAM
*
param
,
u
int
options
);
u
long
options
);
static
int
do_select
(
JOIN
*
join
,
List
<
Item
>
*
fields
,
TABLE
*
tmp_table
,
Procedure
*
proc
);
static
int
sub_select_cache
(
JOIN
*
join
,
JOIN_TAB
*
join_tab
,
bool
end_of_records
);
...
...
@@ -3317,7 +3317,7 @@ Field *create_tmp_field(TABLE *table,Item *item, Item::Type type,
TABLE
*
create_tmp_table
(
THD
*
thd
,
TMP_TABLE_PARAM
*
param
,
List
<
Item
>
&
fields
,
ORDER
*
group
,
bool
distinct
,
bool
save_sum_fields
,
bool
allow_distinct_limit
,
u
int
select_options
)
bool
allow_distinct_limit
,
u
long
select_options
)
{
TABLE
*
table
;
uint
i
,
field_count
,
reclength
,
null_count
,
null_pack_length
,
...
...
@@ -3759,7 +3759,7 @@ static bool open_tmp_table(TABLE *table)
static
bool
create_myisam_tmp_table
(
TABLE
*
table
,
TMP_TABLE_PARAM
*
param
,
u
int
options
)
u
long
options
)
{
int
error
;
MI_KEYDEF
keydef
;
...
...
@@ -3926,6 +3926,12 @@ bool create_myisam_from_heap(TABLE *table, TMP_TABLE_PARAM *param, int error,
goto
err1
;
table
->
file
->
index_end
();
table
->
file
->
rnd_init
();
if
(
table
->
no_rows
)
{
new_table
->
file
->
extra
(
HA_EXTRA_NO_ROWS
);
new_table
->
no_rows
=
1
;
}
/* copy all old rows */
while
(
!
table
->
file
->
rnd_next
(
new_table
.
record
[
1
]))
{
...
...
sql/sql_select.h
View file @
8685094e
...
...
@@ -181,7 +181,7 @@ void TEST_join(JOIN *join);
bool
store_val_in_field
(
Field
*
field
,
Item
*
val
);
TABLE
*
create_tmp_table
(
THD
*
thd
,
TMP_TABLE_PARAM
*
param
,
List
<
Item
>
&
fields
,
ORDER
*
group
,
bool
distinct
,
bool
save_sum_fields
,
bool
allow_distinct_limit
,
u
int
select_options
);
bool
allow_distinct_limit
,
u
long
select_options
);
void
free_tmp_table
(
THD
*
thd
,
TABLE
*
entry
);
void
count_field_types
(
TMP_TABLE_PARAM
*
param
,
List
<
Item
>
&
fields
,
bool
reset_with_sum_func
);
...
...
sql/table.h
View file @
8685094e
...
...
@@ -89,7 +89,7 @@ struct st_table {
my_bool
copy_blobs
;
/* copy_blobs when storing */
my_bool
null_row
;
/* All columns are null */
my_bool
maybe_null
,
outer_join
;
/* Used with OUTER JOIN */
my_bool
distinct
,
const_table
;
my_bool
distinct
,
const_table
,
no_rows
;
my_bool
key_read
;
my_bool
crypted
;
my_bool
db_low_byte_first
;
/* Portable row format */
...
...
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