mirror of
https://github.com/MariaDB/server.git
synced 2025-01-15 19:42:28 +01:00
Merge 10.4 into 10.5
This commit is contained in:
commit
8b9b4ab3f5
168 changed files with 3018 additions and 2202 deletions
6
.gitmodules
vendored
6
.gitmodules
vendored
|
@ -1,19 +1,25 @@
|
|||
[submodule "libmariadb"]
|
||||
path = libmariadb
|
||||
url = https://github.com/MariaDB/mariadb-connector-c.git
|
||||
ignore = all
|
||||
[submodule "storage/rocksdb/rocksdb"]
|
||||
path = storage/rocksdb/rocksdb
|
||||
url = https://github.com/facebook/rocksdb.git
|
||||
ignore = all
|
||||
[submodule "wsrep-lib"]
|
||||
path = wsrep-lib
|
||||
url = https://github.com/codership/wsrep-lib.git
|
||||
branch = master
|
||||
ignore = all
|
||||
[submodule "extra/wolfssl/wolfssl"]
|
||||
path = extra/wolfssl/wolfssl
|
||||
url = https://github.com/wolfSSL/wolfssl.git
|
||||
ignore = all
|
||||
[submodule "storage/maria/libmarias3"]
|
||||
path = storage/maria/libmarias3
|
||||
url = https://github.com/mariadb-corporation/libmarias3.git
|
||||
ignore = all
|
||||
[submodule "storage/columnstore/columnstore"]
|
||||
path = storage/columnstore/columnstore
|
||||
url = https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
|
||||
ignore = all
|
||||
|
|
|
@ -1539,8 +1539,6 @@ bool backup_start(CorruptedPages &corrupted_pages)
|
|||
if (!write_galera_info(mysql_connection)) {
|
||||
return(false);
|
||||
}
|
||||
// copied from xtrabackup. what is it needed for here?
|
||||
write_current_binlog_file(mysql_connection);
|
||||
}
|
||||
|
||||
if (opt_binlog_info == BINLOG_INFO_ON) {
|
||||
|
|
|
@ -1438,14 +1438,18 @@ write_galera_info(MYSQL *connection)
|
|||
|
||||
if ((state_uuid == NULL && state_uuid55 == NULL)
|
||||
|| (last_committed == NULL && last_committed55 == NULL)) {
|
||||
msg("Failed to get master wsrep state from SHOW STATUS.");
|
||||
result = false;
|
||||
msg("Warning: failed to get master wsrep state from SHOW STATUS.");
|
||||
result = true;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
result = backup_file_printf(XTRABACKUP_GALERA_INFO,
|
||||
"%s:%s\n", state_uuid ? state_uuid : state_uuid55,
|
||||
last_committed ? last_committed : last_committed55);
|
||||
if (result)
|
||||
{
|
||||
write_current_binlog_file(connection);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
free_mysql_variables(status);
|
||||
|
|
|
@ -25,6 +25,7 @@ SET(HEADERS
|
|||
mysql.h
|
||||
mysql_com.h
|
||||
mysql_com_server.h
|
||||
mariadb_capi_rename.h
|
||||
pack.h
|
||||
my_byteorder.h
|
||||
byte_order_generic.h
|
||||
|
|
|
@ -33,12 +33,12 @@ extern "C" {
|
|||
#include "my_compare.h"
|
||||
#include "my_tree.h"
|
||||
|
||||
/* defines used by heap-funktions */
|
||||
/* defines used by heap-functions */
|
||||
|
||||
#define HP_MAX_LEVELS 4 /* 128^5 records is enough */
|
||||
#define HP_PTRS_IN_NOD 128
|
||||
|
||||
/* struct used with heap_funktions */
|
||||
/* struct used with heap_functions */
|
||||
|
||||
typedef struct st_heapinfo /* Struct from heap_info */
|
||||
{
|
||||
|
@ -107,7 +107,7 @@ typedef struct st_heap_block
|
|||
ulong last_allocated; /* number of records there is allocated space for */
|
||||
} HP_BLOCK;
|
||||
|
||||
struct st_heap_info; /* For referense */
|
||||
struct st_heap_info; /* For reference */
|
||||
|
||||
typedef struct st_hp_keydef /* Key definition with open */
|
||||
{
|
||||
|
|
|
@ -372,7 +372,7 @@ int json_find_paths_next(json_engine_t *je, json_find_paths_t *state);
|
|||
|
||||
|
||||
/*
|
||||
Converst JSON string constant into ordinary string constant
|
||||
Convert JSON string constant into ordinary string constant
|
||||
which can involve unpacking json escapes and changing character set.
|
||||
Returns negative integer in the case of an error,
|
||||
the length of the result otherwise.
|
||||
|
@ -383,7 +383,7 @@ int json_unescape(CHARSET_INFO *json_cs,
|
|||
uchar *res, uchar *res_end);
|
||||
|
||||
/*
|
||||
Converst ordinary string constant into JSON string constant.
|
||||
Convert ordinary string constant into JSON string constant.
|
||||
which can involve appropriate escaping and changing character set.
|
||||
Returns negative integer in the case of an error,
|
||||
the length of the result otherwise.
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
|
||||
|
||||
/*
|
||||
A better inplementation of the UNIX ctype(3) library.
|
||||
A better implementation of the UNIX ctype(3) library.
|
||||
*/
|
||||
|
||||
#ifndef _m_ctype_h
|
||||
|
@ -137,7 +137,7 @@ uint16 *my_uca_contraction2_weight(const MY_CONTRACTIONS *c,
|
|||
my_wc_t wc1, my_wc_t wc2);
|
||||
|
||||
|
||||
/* Collation weights on a single level (e.g. primary, secondary, tertiarty) */
|
||||
/* Collation weights on a single level (e.g. primary, secondary, tertiary) */
|
||||
typedef struct my_uca_level_info_st
|
||||
{
|
||||
my_wc_t maxchar;
|
||||
|
@ -1519,7 +1519,7 @@ uint32 my_convert(char *to, uint32 to_length, CHARSET_INFO *to_cs,
|
|||
An extended version of my_convert(), to pass non-default mb_wc() and wc_mb().
|
||||
For example, String::copy_printable() which is used in
|
||||
Protocol::store_warning() uses this to escape control
|
||||
and non-convertable characters.
|
||||
and non-convertible characters.
|
||||
*/
|
||||
uint32 my_convert_using_func(char *to, size_t to_length, CHARSET_INFO *to_cs,
|
||||
my_charset_conv_wc_mb mb_wc,
|
||||
|
@ -1600,7 +1600,7 @@ size_t my_convert_fix(CHARSET_INFO *dstcs, char *dst, size_t dst_length,
|
|||
@param str - the beginning of the string
|
||||
@param end - the string end (the next byte after the string)
|
||||
@return >0, for a multi-byte character
|
||||
@rerurn 0, for a single byte character, broken sequence, empty string.
|
||||
@return 0, for a single byte character, broken sequence, empty string.
|
||||
*/
|
||||
static inline
|
||||
uint my_ismbchar(CHARSET_INFO *cs, const char *str, const char *end)
|
||||
|
|
|
@ -78,7 +78,7 @@ enum enum_dyncol_func_result
|
|||
ER_DYNCOL_YES= 1, /* For functions returning 0/1 */
|
||||
ER_DYNCOL_FORMAT= -1, /* Wrong format of the encoded string */
|
||||
ER_DYNCOL_LIMIT= -2, /* Some limit reached */
|
||||
ER_DYNCOL_RESOURCE= -3, /* Out of resourses */
|
||||
ER_DYNCOL_RESOURCE= -3, /* Out of resources */
|
||||
ER_DYNCOL_DATA= -4, /* Incorrect input data */
|
||||
ER_DYNCOL_UNKNOWN_CHARSET= -5, /* Unknown character set */
|
||||
ER_DYNCOL_TRUNCATED= 2 /* OK, but data was truncated */
|
||||
|
|
|
@ -130,7 +130,7 @@ enum ha_extra_function {
|
|||
HA_EXTRA_NO_USER_CHANGE=9, /* No user is allowed to write */
|
||||
HA_EXTRA_KEY_CACHE=10,
|
||||
HA_EXTRA_NO_KEY_CACHE=11,
|
||||
HA_EXTRA_WAIT_LOCK=12, /* Wait until file is avalably (def) */
|
||||
HA_EXTRA_WAIT_LOCK=12, /* Wait until file is available (def) */
|
||||
HA_EXTRA_NO_WAIT_LOCK=13, /* If file is locked, return quickly */
|
||||
HA_EXTRA_WRITE_CACHE=14, /* Use write cache in ha_write() */
|
||||
HA_EXTRA_FLUSH_CACHE=15, /* flush write_record_cache */
|
||||
|
@ -291,7 +291,7 @@ enum ha_base_keytype {
|
|||
This flag can be calculated -- it's based on key lengths comparison.
|
||||
*/
|
||||
#define HA_KEY_HAS_PART_KEY_SEG 65536
|
||||
/* Internal Flag Can be calcaluted */
|
||||
/* Internal Flag Can be calculated */
|
||||
#define HA_INVISIBLE_KEY 2<<18
|
||||
/* Automatic bits in key-flag */
|
||||
|
||||
|
@ -438,9 +438,9 @@ enum ha_base_keytype {
|
|||
#define HA_ERR_FIRST 120 /* Copy of first error nr.*/
|
||||
|
||||
#define HA_ERR_KEY_NOT_FOUND 120 /* Didn't find key on read or update */
|
||||
#define HA_ERR_FOUND_DUPP_KEY 121 /* Dupplicate key on write */
|
||||
#define HA_ERR_FOUND_DUPP_KEY 121 /* Duplicate key on write */
|
||||
#define HA_ERR_INTERNAL_ERROR 122 /* Internal error */
|
||||
#define HA_ERR_RECORD_CHANGED 123 /* Uppdate with is recoverable */
|
||||
#define HA_ERR_RECORD_CHANGED 123 /* Update with is recoverable */
|
||||
#define HA_ERR_WRONG_INDEX 124 /* Wrong index given to function */
|
||||
#define HA_ERR_CRASHED 126 /* Indexfile is crashed */
|
||||
#define HA_ERR_WRONG_IN_RECORD 127 /* Record-file is crashed */
|
||||
|
@ -456,7 +456,7 @@ enum ha_base_keytype {
|
|||
#define HA_ERR_UNSUPPORTED 138 /* unsupported extension used */
|
||||
#define HA_ERR_TO_BIG_ROW 139 /* Too big row */
|
||||
#define HA_WRONG_CREATE_OPTION 140 /* Wrong create option */
|
||||
#define HA_ERR_FOUND_DUPP_UNIQUE 141 /* Dupplicate unique on write */
|
||||
#define HA_ERR_FOUND_DUPP_UNIQUE 141 /* Duplicate unique on write */
|
||||
#define HA_ERR_UNKNOWN_CHARSET 142 /* Can't open charset */
|
||||
#define HA_ERR_WRONG_MRG_TABLE_DEF 143 /* conflicting tables in MERGE */
|
||||
#define HA_ERR_CRASHED_ON_REPAIR 144 /* Last (automatic?) repair failed */
|
||||
|
@ -500,7 +500,7 @@ enum ha_base_keytype {
|
|||
illegal data being read */
|
||||
#define HA_ERR_NEW_FILE 172 /* New file format */
|
||||
#define HA_ERR_ROWS_EVENT_APPLY 173 /* The event could not be processed
|
||||
no other hanlder error happened */
|
||||
no other handler error happened */
|
||||
#define HA_ERR_INITIALIZATION 174 /* Error during initialization */
|
||||
#define HA_ERR_FILE_TOO_SHORT 175 /* File too short */
|
||||
#define HA_ERR_WRONG_CRC 176 /* Wrong CRC on page */
|
||||
|
|
|
@ -132,7 +132,7 @@ extern HA_KEYSEG *ha_find_null(HA_KEYSEG *keyseg, const uchar *a);
|
|||
|
||||
0=CHECK_NEG - The filter is not satisfied. The engine should discard this
|
||||
index tuple and continue the scan.
|
||||
1=CHECK_POS - The filter is statisfied. Current index tuple should be
|
||||
1=CHECK_POS - The filter is satisfied. Current index tuple should be
|
||||
returned to the SQL layer.
|
||||
2=CHECK_OUT_OF_RANGE - the index tuple is outside of the range that we're
|
||||
scanning. (Example: if we're scanning "t.key BETWEEN 10 AND
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
digits in one our big digit decreased by 1 (because we always put decimal
|
||||
point on the border of our big digits))
|
||||
|
||||
With normal precession we can handle 65 digits. MariaDB can store in
|
||||
With normal precision we can handle 65 digits. MariaDB can store in
|
||||
the .frm up to 63 digits. By default we use DECIMAL_NOT_SPECIFIED digits
|
||||
when converting strings to decimal, so we don't want to set this too high.
|
||||
To not use up all digits for the scale we limit the number of decimals to
|
||||
|
|
|
@ -70,7 +70,7 @@ typedef struct my_stat
|
|||
dev_t st_rdev; /* more major & minor device numbers (???) */
|
||||
off_t st_size; /* size of file */
|
||||
time_t st_atime; /* time for last read */
|
||||
time_t st_mtime; /* time for last contens modify */
|
||||
time_t st_mtime; /* time for last contents modify */
|
||||
time_t st_ctime; /* time for last inode or contents modify */
|
||||
} MY_STAT;
|
||||
|
||||
|
|
|
@ -630,7 +630,7 @@ typedef SOCKET_SIZE_TYPE size_socket;
|
|||
the mismatch of CRT and mysys file IO usage on Windows at runtime.
|
||||
CRT file descriptors can be in the range 0-2047, whereas descriptors returned
|
||||
by my_open() will start with 2048. If a file descriptor with value less then
|
||||
MY_FILE_MIN is passed to mysys IO function, chances are it stemms from
|
||||
MY_FILE_MIN is passed to mysys IO function, chances are it stems from
|
||||
open()/fileno() and not my_open()/my_fileno.
|
||||
|
||||
For Posix, mysys functions are light wrappers around libc, and MY_FILE_MIN
|
||||
|
@ -853,7 +853,7 @@ typedef long long my_ptrdiff_t;
|
|||
#define STDCALL
|
||||
#endif
|
||||
|
||||
/* Typdefs for easyier portability */
|
||||
/* Typdefs for easier portability */
|
||||
|
||||
#ifndef HAVE_UCHAR
|
||||
typedef unsigned char uchar; /* Short for unsigned char */
|
||||
|
|
|
@ -90,7 +90,7 @@ C_MODE_START
|
|||
how to ensure that it can be accessed.
|
||||
On AARCH64, we use the generic timer base register. We override clang
|
||||
implementation for aarch64 as it access a PMU register which is not
|
||||
guarenteed to be active.
|
||||
guaranteed to be active.
|
||||
|
||||
Sadly, we have nothing for the Digital Alpha, MIPS, Motorola m68k,
|
||||
HP PA-RISC or other non-mainstream (or obsolete) processors.
|
||||
|
|
|
@ -423,7 +423,7 @@ typedef struct st_io_cache /* Used when caching files */
|
|||
/*
|
||||
A caller will use my_b_read() macro to read from the cache
|
||||
if the data is already in cache, it will be simply copied with
|
||||
memcpy() and internal variables will be accordinging updated with
|
||||
memcpy() and internal variables will be accordingly updated with
|
||||
no functions invoked. However, if the data is not fully in the cache,
|
||||
my_b_read() will call read_function to fetch the data. read_function
|
||||
must never be invoked directly.
|
||||
|
@ -467,7 +467,7 @@ typedef struct st_io_cache /* Used when caching files */
|
|||
myf myflags; /* Flags used to my_read/my_write */
|
||||
/*
|
||||
alloced_buffer is set to the size of the buffer allocated for the IO_CACHE.
|
||||
Includes the overhead(storing key to ecnrypt and decrypt) for encryption.
|
||||
Includes the overhead(storing key to encrypt and decrypt) for encryption.
|
||||
Set to 0 if nothing is allocated.
|
||||
Currently READ_NET is the only one that will use a buffer allocated
|
||||
somewhere else
|
||||
|
@ -984,7 +984,7 @@ static inline my_hrtime_t make_hr_time(my_time_t time, ulong time_sec_part)
|
|||
#define my_munmap(a,b) munmap((a),(b))
|
||||
|
||||
#else
|
||||
/* not a complete set of mmap() flags, but only those that nesessary */
|
||||
/* not a complete set of mmap() flags, but only those that necessary */
|
||||
#define PROT_READ 1
|
||||
#define PROT_WRITE 2
|
||||
#define MAP_NORESERVE 0
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
|
||||
|
||||
/* This file should be included when using myisam_funktions */
|
||||
/* This file should be included when using myisam_functions */
|
||||
|
||||
#ifndef _myisam_h
|
||||
#define _myisam_h
|
||||
|
@ -159,7 +159,7 @@ typedef struct st_mi_create_info
|
|||
my_bool with_auto_increment;
|
||||
} MI_CREATE_INFO;
|
||||
|
||||
struct st_myisam_info; /* For referense */
|
||||
struct st_myisam_info; /* For reference */
|
||||
struct st_mi_isam_share;
|
||||
typedef struct st_myisam_info MI_INFO;
|
||||
struct st_mi_s_param;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1335 USA */
|
||||
|
||||
/* This file should be included when using merge_isam_funktions */
|
||||
/* This file should be included when using merge_isam_functions */
|
||||
|
||||
#ifndef _myisammrg_h
|
||||
#define _myisammrg_h
|
||||
|
@ -51,7 +51,7 @@ typedef struct st_mymerge_info /* Struct from h_info */
|
|||
ulonglong data_file_length;
|
||||
ulonglong dupp_key_pos; /* Offset of the Duplicate key in the merge table */
|
||||
uint reclength; /* Recordlength */
|
||||
int errkey; /* With key was dupplicated on err */
|
||||
int errkey; /* With key was duplicated on err */
|
||||
uint options; /* HA_OPTION_... used */
|
||||
ulong *rec_per_key; /* for sql optimizing */
|
||||
} MYMERGE_INFO;
|
||||
|
|
|
@ -666,7 +666,7 @@ enum enum_mysql_stmt_state
|
|||
|
||||
length - On input: in case when lengths of input values
|
||||
are different for each execute, you can set this to
|
||||
point at a variable containining value length. This
|
||||
point at a variable containing value length. This
|
||||
way the value length can be different in each execute.
|
||||
If length is not NULL, buffer_length is not used.
|
||||
Note, length can even point at buffer_length if
|
||||
|
|
|
@ -101,7 +101,7 @@ enum enum_ft_token_type
|
|||
<0 Must not be present
|
||||
0 Neither; the word is optional but its presence increases the relevance
|
||||
With the default settings of the ft_boolean_syntax system variable,
|
||||
>0 corresponds to the '+' operator, <0 corrresponds to the '-' operator,
|
||||
>0 corresponds to the '+' operator, <0 corresponds to the '-' operator,
|
||||
and 0 means neither operator was used.
|
||||
|
||||
weight_adjust: A weighting factor that determines how much a match
|
||||
|
|
|
@ -625,7 +625,7 @@ typedef struct st_mysql_cond mysql_cond_t;
|
|||
This function creates both the thread instrumentation and a thread.
|
||||
@c mysql_thread_create is a replacement for @c pthread_create.
|
||||
The parameter P4 (or, if it is NULL, P1) will be used as the
|
||||
instrumented thread "indentity".
|
||||
instrumented thread "identity".
|
||||
Providing a P1 / P4 parameter with a different value for each call
|
||||
will on average improve performances, since this thread identity value
|
||||
is used internally to randomize access to data and prevent contention.
|
||||
|
|
|
@ -29,7 +29,7 @@ extern "C" {
|
|||
#include <stdlib.h>
|
||||
#endif
|
||||
|
||||
/* Allow multuple chunks 'AAA= AA== AA==', binlog uses this */
|
||||
/* Allow multiple chunks 'AAA= AA== AA==', binlog uses this */
|
||||
#define MY_BASE64_DECODE_ALLOW_MULTIPLE_CHUNKS 1
|
||||
|
||||
extern struct base64_service_st {
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
@post
|
||||
The syntax of a format string is generally the same:
|
||||
% <flag> <width> <precision> <length modifier> <format>
|
||||
where everithing but the format is optional.
|
||||
where everything but the format is optional.
|
||||
|
||||
Three one-character flags are recognized:
|
||||
'0' has the standard zero-padding semantics;
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
|
||||
/**
|
||||
@file
|
||||
This service provdes functions to convert between my_time_t and
|
||||
This service provides functions to convert between my_time_t and
|
||||
MYSQL_TIME taking into account the current value of the time_zone
|
||||
session variable.
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
*/
|
||||
|
||||
/*
|
||||
Code for generell handling of priority Queues.
|
||||
Code for general handling of priority Queues.
|
||||
Implementation of queues from "Algorithms in C" by Robert Sedgewick.
|
||||
*/
|
||||
|
||||
|
|
|
@ -81,7 +81,7 @@ typedef struct st_wt_thd {
|
|||
1. Latest
|
||||
Keep all weights equal.
|
||||
2. Random
|
||||
Assight weights at random.
|
||||
Assign weights at random.
|
||||
(variant: modify a weight randomly before every lock request)
|
||||
3. Youngest
|
||||
Set weight to -NOW()
|
||||
|
|
6
mysql-test/include/have_gzip.inc
Normal file
6
mysql-test/include/have_gzip.inc
Normal file
|
@ -0,0 +1,6 @@
|
|||
--error 0,1,127
|
||||
--exec gzip --version > /dev/null 2> /dev/null
|
||||
if ($sys_errno)
|
||||
{
|
||||
--skip Requires gzip executable
|
||||
}
|
7
mysql-test/include/maybe_versioning.combinations
Normal file
7
mysql-test/include/maybe_versioning.combinations
Normal file
|
@ -0,0 +1,7 @@
|
|||
[orig]
|
||||
|
||||
[vers]
|
||||
system_versioning_alter_history=keep
|
||||
|
||||
[vers_trx]
|
||||
system_versioning_alter_history=keep
|
47
mysql-test/include/maybe_versioning.inc
Normal file
47
mysql-test/include/maybe_versioning.inc
Normal file
|
@ -0,0 +1,47 @@
|
|||
# include file for test files that can be run with and without debug
|
||||
# having debug and non-debug tests.
|
||||
|
||||
# If $modify_create_table is true CREATE statement must be evaluated with
|
||||
# $create_options that adds WITH SYSTEM VERSIONING to the statement. Otherwise
|
||||
# system versioning is added implicitly via debug options. The second variant
|
||||
# can easily be added to any test but works only for debug builds.
|
||||
|
||||
if ($modify_create_table)
|
||||
{
|
||||
if ($MTR_COMBINATION_VERS)
|
||||
{
|
||||
let $create_options= `select ' WITH SYSTEM VERSIONING'`;
|
||||
}
|
||||
|
||||
if ($MTR_COMBINATION_VERS_TRX)
|
||||
{
|
||||
--skip Not tested
|
||||
}
|
||||
}
|
||||
|
||||
if (!$modify_create_table)
|
||||
{
|
||||
let $have_debug=`select version() like '%debug%'`;
|
||||
|
||||
if ($MTR_COMBINATION_VERS)
|
||||
{
|
||||
if (!$have_debug)
|
||||
{
|
||||
--skip Requires debug
|
||||
}
|
||||
--disable_query_log
|
||||
set debug_dbug="d,sysvers_force_trx,sysvers_hide";
|
||||
--enable_query_log
|
||||
}
|
||||
|
||||
if ($MTR_COMBINATION_VERS_TRX)
|
||||
{
|
||||
if (!$have_debug)
|
||||
{
|
||||
--skip Requires debug
|
||||
}
|
||||
--disable_query_log
|
||||
set debug_dbug="d,sysvers_force,sysvers_hide";
|
||||
--enable_query_log
|
||||
}
|
||||
}
|
|
@ -12,25 +12,32 @@ if (!$restart_noprint)
|
|||
--let $restart_noprint=0
|
||||
}
|
||||
|
||||
--let $restart_cmd= restart
|
||||
|
||||
if ($restart_bindir)
|
||||
{
|
||||
--let $restart_cmd= restart_bindir $restart_bindir
|
||||
}
|
||||
|
||||
if ($restart_parameters)
|
||||
{
|
||||
--exec echo "restart: $restart_parameters" > $_expect_file_name
|
||||
--exec echo "$restart_cmd: $restart_parameters" > $_expect_file_name
|
||||
if (!$restart_noprint)
|
||||
{
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
--exec echo "# restart: $restart_parameters"
|
||||
--replace_result $MYSQL_TEST_DIR MYSQL_TEST_DIR $MYSQLTEST_VARDIR MYSQLTEST_VARDIR
|
||||
--exec echo "# $restart_cmd: $restart_parameters"
|
||||
}
|
||||
if ($restart_noprint == 1)
|
||||
{
|
||||
--exec echo "# restart: with restart_parameters"
|
||||
--exec echo "# $restart_cmd: with restart_parameters"
|
||||
}
|
||||
}
|
||||
if (!$restart_parameters)
|
||||
{
|
||||
--exec echo "restart" > $_expect_file_name
|
||||
--exec echo "$restart_cmd" > $_expect_file_name
|
||||
if ($restart_noprint < 2)
|
||||
{
|
||||
--exec echo "# restart"
|
||||
--exec echo "# $restart_cmd"
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ for my $f (keys %print_formats)
|
|||
|
||||
register_opt('print-core|C', ':s',
|
||||
"Print core dump format: ". $print_formats. " (for not printing cores). ".
|
||||
"Defaults to value of MTR_PRINT_CORE or 'short'");
|
||||
"Defaults to value of MTR_PRINT_CORE or 'medium'");
|
||||
if (!IS_WINDOWS)
|
||||
{
|
||||
register_opt('print-method', '=s',
|
||||
|
@ -134,7 +134,7 @@ sub env_or_default($$) {
|
|||
}
|
||||
|
||||
sub pre_setup() {
|
||||
$config{print_core}= env_or_default('short', 'MTR_PRINT_CORE')
|
||||
$config{print_core}= env_or_default('medium', 'MTR_PRINT_CORE')
|
||||
if not defined $config{print_core};
|
||||
$config{print_method}= (IS_WINDOWS) ? 'cdb' : 'auto'
|
||||
if not defined $config{print_method};
|
||||
|
|
|
@ -4230,7 +4230,9 @@ drop table t1;
|
|||
#
|
||||
# MDEV-24019: query with recursive CTE when no default database is set
|
||||
#
|
||||
drop database test;
|
||||
create database dummy;
|
||||
use dummy;
|
||||
drop database dummy;
|
||||
with recursive a as
|
||||
(select 1 from dual union select * from a as r)
|
||||
select * from a;
|
||||
|
@ -4269,7 +4271,6 @@ a
|
|||
1
|
||||
deallocate prepare stmt;
|
||||
drop database db1;
|
||||
create database test;
|
||||
use test;
|
||||
#
|
||||
# MDEV-23406: query with mutually recursive CTEs when big_tables=1
|
||||
|
|
|
@ -2732,7 +2732,9 @@ drop table t1;
|
|||
--echo # MDEV-24019: query with recursive CTE when no default database is set
|
||||
--echo #
|
||||
|
||||
drop database test;
|
||||
create database dummy;
|
||||
use dummy;
|
||||
drop database dummy;
|
||||
|
||||
let $q=
|
||||
with recursive a as
|
||||
|
@ -2760,7 +2762,6 @@ deallocate prepare stmt;
|
|||
|
||||
drop database db1;
|
||||
|
||||
create database test;
|
||||
use test;
|
||||
|
||||
--echo #
|
||||
|
|
|
@ -2553,5 +2553,19 @@ DROP TABLE t1;
|
|||
#
|
||||
SET STATEMENT sql_mode=ONLY_FULL_GROUP_BY FOR EXECUTE IMMEDIATE 'ALTER TABLE mysql.time_zone_transition ORDER BY Time_zone_id, Transition_time';
|
||||
#
|
||||
# MDEV-19071 Wrong results when using STDDEV_SAMP() and view
|
||||
#
|
||||
create table t1(i int);
|
||||
insert into t1 values (1),(2),(3),(4),(5);
|
||||
create view v1 as select stddev_samp(i),stddev_pop(i),stddev(i),std(i) from t1;
|
||||
show create view v1;
|
||||
View Create View character_set_client collation_connection
|
||||
v1 CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`localhost` SQL SECURITY DEFINER VIEW `v1` AS select stddev_samp(`t1`.`i`) AS `stddev_samp(i)`,std(`t1`.`i`) AS `stddev_pop(i)`,std(`t1`.`i`) AS `stddev(i)`,std(`t1`.`i`) AS `std(i)` from `t1` latin1 latin1_swedish_ci
|
||||
select * from v1;
|
||||
stddev_samp(i) stddev_pop(i) stddev(i) std(i)
|
||||
1.5811 1.4142 1.4142 1.4142
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
#
|
||||
# End of 10.3 tests
|
||||
#
|
||||
|
|
|
@ -1790,6 +1790,17 @@ DROP TABLE t1;
|
|||
|
||||
SET STATEMENT sql_mode=ONLY_FULL_GROUP_BY FOR EXECUTE IMMEDIATE 'ALTER TABLE mysql.time_zone_transition ORDER BY Time_zone_id, Transition_time';
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-19071 Wrong results when using STDDEV_SAMP() and view
|
||||
--echo #
|
||||
create table t1(i int);
|
||||
insert into t1 values (1),(2),(3),(4),(5);
|
||||
create view v1 as select stddev_samp(i),stddev_pop(i),stddev(i),std(i) from t1;
|
||||
show create view v1;
|
||||
select * from v1;
|
||||
drop view v1;
|
||||
drop table t1;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
--echo #
|
||||
|
|
|
@ -3092,12 +3092,15 @@ SELECT IS_USED_LOCK(POINT(1,1));
|
|||
--echo #
|
||||
--echo # MDEV-26161 crash in Gis_point::calculate_haversine
|
||||
--echo #
|
||||
#enable after fix MDEV-30229
|
||||
--disable_view_protocol
|
||||
--error ER_CANT_CREATE_GEOMETRY_OBJECT
|
||||
select st_distance_sphere(x'01030000000400000004000000000000', multipoint(point(124,204)), 10);
|
||||
--error ER_CANT_CREATE_GEOMETRY_OBJECT
|
||||
select st_distance_sphere(x'010300000004000000040000', multipoint(point(124,204)), 10);
|
||||
--error ER_CANT_CREATE_GEOMETRY_OBJECT
|
||||
select st_distance_sphere(x'010300000001000000040000', multipoint(point(124,204)), 10);
|
||||
--enable_view_protocol
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
|
|
|
@ -2234,8 +2234,9 @@ Warning 1931 Query execution was interrupted. The query examined at least ### ro
|
|||
# m_status == DA_OK_BULK' failed in Diagnostics_area::message()
|
||||
#
|
||||
call mtr.add_suppression("Sort aborted.*");
|
||||
DROP DATABASE test;
|
||||
CREATE DATABASE test;
|
||||
create database dummy;
|
||||
use dummy;
|
||||
drop database dummy;
|
||||
USE test;
|
||||
CREATE VIEW v AS SELECT table_schema AS object_schema, table_name AS object_name, table_type AS object_type FROM information_schema.tables ORDER BY object_schema;
|
||||
SELECT * FROM v LIMIT ROWS EXAMINED 9;
|
||||
|
|
|
@ -1938,8 +1938,9 @@ SELECT * FROM INFORMATION_SCHEMA.`COLUMNS` LIMIT ROWS EXAMINED 10;
|
|||
|
||||
call mtr.add_suppression("Sort aborted.*");
|
||||
|
||||
DROP DATABASE test;
|
||||
CREATE DATABASE test;
|
||||
create database dummy;
|
||||
use dummy;
|
||||
drop database dummy;
|
||||
USE test;
|
||||
CREATE VIEW v AS SELECT table_schema AS object_schema, table_name AS object_name, table_type AS object_type FROM information_schema.tables ORDER BY object_schema;
|
||||
|
||||
|
|
|
@ -853,7 +853,7 @@ LENGTH(Language) < LENGTH(City.Name) - 2;
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
|
||||
1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join)
|
||||
1 SIMPLE CountryLanguage hash_ALL PRIMARY,Percentage #hash#PRIMARY 3 world.City.Country 984 Using where; Using join buffer (flat, BNLH join)
|
||||
1 SIMPLE CountryLanguage hash_ALL|filter PRIMARY,Percentage #hash#PRIMARY|Percentage 3|4 world.City.Country 984 (19%) Using where; Using join buffer (flat, BNLH join); Using rowid filter
|
||||
SELECT City.Name, Country.Name, CountryLanguage.Language
|
||||
FROM City,Country,CountryLanguage
|
||||
WHERE City.Country=Country.Code AND
|
||||
|
@ -1053,7 +1053,7 @@ LENGTH(Language) < LENGTH(City.Name) - 2;
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
|
||||
1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join)
|
||||
1 SIMPLE CountryLanguage hash_ALL PRIMARY,Percentage #hash#PRIMARY 3 world.City.Country 984 Using where; Using join buffer (incremental, BNLH join)
|
||||
1 SIMPLE CountryLanguage hash_ALL|filter PRIMARY,Percentage #hash#PRIMARY|Percentage 3|4 world.City.Country 984 (19%) Using where; Using join buffer (incremental, BNLH join); Using rowid filter
|
||||
SELECT City.Name, Country.Name, CountryLanguage.Language
|
||||
FROM City,Country,CountryLanguage
|
||||
WHERE City.Country=Country.Code AND
|
||||
|
@ -1312,7 +1312,7 @@ LENGTH(Language) < LENGTH(City.Name) - 2;
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
|
||||
1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
|
||||
1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
|
||||
1 SIMPLE CountryLanguage ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter
|
||||
SELECT City.Name, Country.Name, CountryLanguage.Language
|
||||
FROM City,Country,CountryLanguage
|
||||
WHERE City.Country=Country.Code AND
|
||||
|
@ -1509,7 +1509,7 @@ LENGTH(Language) < LENGTH(City.Name) - 2;
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
|
||||
1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
|
||||
1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
|
||||
1 SIMPLE CountryLanguage ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter
|
||||
SELECT City.Name, Country.Name, CountryLanguage.Language
|
||||
FROM City,Country,CountryLanguage
|
||||
WHERE City.Country=Country.Code AND
|
||||
|
@ -1706,7 +1706,7 @@ LENGTH(Language) < LENGTH(City.Name) - 2;
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
|
||||
1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
|
||||
1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
|
||||
1 SIMPLE CountryLanguage ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan; Using rowid filter
|
||||
SELECT City.Name, Country.Name, CountryLanguage.Language
|
||||
FROM City,Country,CountryLanguage
|
||||
WHERE City.Country=Country.Code AND
|
||||
|
@ -1903,7 +1903,7 @@ LENGTH(Language) < LENGTH(City.Name) - 2;
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
|
||||
1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
|
||||
1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan
|
||||
1 SIMPLE CountryLanguage ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan; Using rowid filter
|
||||
SELECT City.Name, Country.Name, CountryLanguage.Language
|
||||
FROM City,Country,CountryLanguage
|
||||
WHERE City.Country=Country.Code AND
|
||||
|
@ -2104,7 +2104,7 @@ LENGTH(Language) < LENGTH(City.Name) - 2;
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
|
||||
1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join)
|
||||
1 SIMPLE CountryLanguage hash_ALL PRIMARY,Percentage #hash#PRIMARY 3 world.City.Country 984 Using where; Using join buffer (flat, BNLH join)
|
||||
1 SIMPLE CountryLanguage hash_ALL|filter PRIMARY,Percentage #hash#PRIMARY|Percentage 3|4 world.City.Country 984 (19%) Using where; Using join buffer (flat, BNLH join); Using rowid filter
|
||||
SELECT City.Name, Country.Name, CountryLanguage.Language
|
||||
FROM City,Country,CountryLanguage
|
||||
WHERE City.Country=Country.Code AND
|
||||
|
@ -2208,7 +2208,7 @@ LENGTH(Language) < LENGTH(City.Name) - 2;
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
|
||||
1 SIMPLE Country hash_ALL PRIMARY #hash#PRIMARY 3 world.City.Country 239 Using where; Using join buffer (flat, BNLH join)
|
||||
1 SIMPLE CountryLanguage hash_ALL PRIMARY,Percentage #hash#PRIMARY 3 world.City.Country 984 Using where; Using join buffer (incremental, BNLH join)
|
||||
1 SIMPLE CountryLanguage hash_ALL|filter PRIMARY,Percentage #hash#PRIMARY|Percentage 3|4 world.City.Country 984 (19%) Using where; Using join buffer (incremental, BNLH join); Using rowid filter
|
||||
SELECT City.Name, Country.Name, CountryLanguage.Language
|
||||
FROM City,Country,CountryLanguage
|
||||
WHERE City.Country=Country.Code AND
|
||||
|
@ -2312,7 +2312,7 @@ LENGTH(Language) < LENGTH(City.Name) - 2;
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
|
||||
1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
|
||||
1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
|
||||
1 SIMPLE CountryLanguage ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter
|
||||
SELECT City.Name, Country.Name, CountryLanguage.Language
|
||||
FROM City,Country,CountryLanguage
|
||||
WHERE City.Country=Country.Code AND
|
||||
|
@ -2416,7 +2416,7 @@ LENGTH(Language) < LENGTH(City.Name) - 2;
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
|
||||
1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
|
||||
1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan
|
||||
1 SIMPLE CountryLanguage ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (incremental, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter
|
||||
SELECT City.Name, Country.Name, CountryLanguage.Language
|
||||
FROM City,Country,CountryLanguage
|
||||
WHERE City.Country=Country.Code AND
|
||||
|
@ -2520,7 +2520,7 @@ LENGTH(Language) < LENGTH(City.Name) - 2;
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
|
||||
1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
|
||||
1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
|
||||
1 SIMPLE CountryLanguage ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan; Using rowid filter
|
||||
SELECT City.Name, Country.Name, CountryLanguage.Language
|
||||
FROM City,Country,CountryLanguage
|
||||
WHERE City.Country=Country.Code AND
|
||||
|
@ -2624,7 +2624,7 @@ LENGTH(Language) < LENGTH(City.Name) - 2;
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE City ALL Country NULL NULL NULL 4079 Using where
|
||||
1 SIMPLE Country eq_ref PRIMARY PRIMARY 3 world.City.Country 1 Using where; Using join buffer (flat, BKAH join); Key-ordered Rowid-ordered scan
|
||||
1 SIMPLE CountryLanguage ref PRIMARY,Percentage PRIMARY 3 world.City.Country 4 Using index condition(BKA); Using where; Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan
|
||||
1 SIMPLE CountryLanguage ref|filter PRIMARY,Percentage PRIMARY|Percentage 3|4 world.City.Country 4 (19%) Using index condition(BKA); Using where; Using join buffer (incremental, BKAH join); Key-ordered Rowid-ordered scan; Using rowid filter
|
||||
SELECT City.Name, Country.Name, CountryLanguage.Language
|
||||
FROM City,Country,CountryLanguage
|
||||
WHERE City.Country=Country.Code AND
|
||||
|
|
|
@ -64,7 +64,7 @@ rows_affected int(11) NO NULL
|
|||
flush slow logs;
|
||||
set long_query_time=0.1;
|
||||
set log_slow_filter='';
|
||||
set global slow_query_log=1;
|
||||
set slow_query_log=1;
|
||||
set global log_output='TABLE';
|
||||
select sleep(0.5);
|
||||
sleep(0.5)
|
||||
|
@ -73,7 +73,7 @@ select count(*) FROM mysql.slow_log;
|
|||
count(*)
|
||||
1
|
||||
set @@long_query_time=default;
|
||||
set global slow_query_log= @org_slow_query_log;
|
||||
set @@slow_query_log=default;
|
||||
set @@log_slow_filter=default;
|
||||
set @@log_slow_verbosity=default;
|
||||
set global log_output= default;
|
||||
|
@ -115,3 +115,21 @@ Slow_queries_increment
|
|||
SET log_slow_filter=DEFAULT;
|
||||
SET @@long_query_time=default;
|
||||
SET GLOBAL slow_query_log= @org_slow_query_log;
|
||||
#
|
||||
# MDEV-21187: log_slow_filter="" logs queries not using indexes
|
||||
#
|
||||
flush status;
|
||||
create table t (id int);
|
||||
insert into t values (1),(4);
|
||||
set log_slow_filter='';
|
||||
select * from t;
|
||||
id
|
||||
1
|
||||
4
|
||||
show session status like 'Slow_queries';
|
||||
Variable_name Value
|
||||
Slow_queries 0
|
||||
drop table t;
|
||||
#
|
||||
# End of 10.3 tests
|
||||
#
|
||||
|
|
|
@ -50,14 +50,14 @@ flush slow logs;
|
|||
# MDEV-4206 (empty filter should be no filter)
|
||||
set long_query_time=0.1;
|
||||
set log_slow_filter='';
|
||||
set global slow_query_log=1;
|
||||
set slow_query_log=1;
|
||||
set global log_output='TABLE';
|
||||
select sleep(0.5);
|
||||
select count(*) FROM mysql.slow_log;
|
||||
|
||||
# Reset used variables
|
||||
set @@long_query_time=default;
|
||||
set global slow_query_log= @org_slow_query_log;
|
||||
set @@slow_query_log=default;
|
||||
set @@log_slow_filter=default;
|
||||
set @@log_slow_verbosity=default;
|
||||
set global log_output= default;
|
||||
|
@ -102,3 +102,20 @@ SET log_slow_filter=DEFAULT;
|
|||
|
||||
SET @@long_query_time=default;
|
||||
SET GLOBAL slow_query_log= @org_slow_query_log;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-21187: log_slow_filter="" logs queries not using indexes
|
||||
--echo #
|
||||
|
||||
flush status;
|
||||
create table t (id int);
|
||||
insert into t values (1),(4);
|
||||
set log_slow_filter='';
|
||||
select * from t;
|
||||
show session status like 'Slow_queries';
|
||||
|
||||
drop table t;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
--echo #
|
||||
|
|
|
@ -4471,6 +4471,7 @@ Db Name Definer Time zone Type Execute at Interval value Interval field Starts E
|
|||
# MDEV-13336: add ignore-database option
|
||||
# with --all-databases
|
||||
#
|
||||
SET GLOBAL innodb_max_purge_lag_wait=0;
|
||||
DROP DATABASE test;
|
||||
SHOW DATABASES LIKE 'test';
|
||||
Database (test)
|
||||
|
|
|
@ -1922,6 +1922,8 @@ SHOW EVENTS;
|
|||
--echo # with --all-databases
|
||||
--echo #
|
||||
--exec $MYSQL_DUMP --default-character-set=utf8mb4 --ignore-database test --all-databases > $MYSQLTEST_VARDIR/tmp/mysqldump-MDEV-13336.sql
|
||||
# Starting with MariaDB 10.6, ensure that DDL recovery will have completed.
|
||||
SET GLOBAL innodb_max_purge_lag_wait=0;
|
||||
DROP DATABASE test;
|
||||
--exec $MYSQL < $MYSQLTEST_VARDIR/tmp/mysqldump-MDEV-13336.sql
|
||||
SHOW DATABASES LIKE 'test';
|
||||
|
|
|
@ -1016,6 +1016,7 @@ explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b {
|
|||
"index": "a",
|
||||
"used_range_estimates": false,
|
||||
"cause": "not available",
|
||||
"rowid_filter_skipped": "cost_factor <= 0",
|
||||
"rows": 1,
|
||||
"cost": 200.0585794,
|
||||
"chosen": true
|
||||
|
@ -1072,6 +1073,7 @@ explain select * from t1,t2 where t1.a=t2.b+2 and t2.a= t1.b {
|
|||
"index": "a",
|
||||
"used_range_estimates": false,
|
||||
"cause": "not available",
|
||||
"rowid_filter_skipped": "cost_factor <= 0",
|
||||
"rows": 1,
|
||||
"cost": 200.0585794,
|
||||
"chosen": true
|
||||
|
@ -2084,6 +2086,7 @@ explain select * from t1 where a=1 and b=2 order by c limit 1 {
|
|||
"access_type": "ref",
|
||||
"index": "a_c",
|
||||
"used_range_estimates": true,
|
||||
"rowid_filter_skipped": "worst/max seeks clipping",
|
||||
"rows": 180,
|
||||
"cost": 180.2743776,
|
||||
"chosen": true
|
||||
|
@ -3959,6 +3962,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
|
|||
"index": "a",
|
||||
"used_range_estimates": false,
|
||||
"cause": "not better than ref estimates",
|
||||
"rowid_filter_skipped": "cost_factor <= 0",
|
||||
"rows": 1,
|
||||
"cost": 3.001757383,
|
||||
"chosen": true
|
||||
|
@ -4014,6 +4018,7 @@ explain delete t0,t1 from t0, t1 where t0.a=t1.a and t1.a<3 {
|
|||
"index": "a",
|
||||
"used_range_estimates": false,
|
||||
"cause": "not better than ref estimates",
|
||||
"rowid_filter_skipped": "worst/max seeks clipping",
|
||||
"rows": 2,
|
||||
"cost": 3.003514767,
|
||||
"chosen": true
|
||||
|
@ -8110,6 +8115,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
|
|||
"index": "b",
|
||||
"used_range_estimates": false,
|
||||
"cause": "not available",
|
||||
"rowid_filter_skipped": "cost_factor <= 0",
|
||||
"rows": 1,
|
||||
"cost": 20.00585794,
|
||||
"chosen": true
|
||||
|
@ -8334,6 +8340,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
|
|||
"index": "a",
|
||||
"used_range_estimates": false,
|
||||
"cause": "not available",
|
||||
"rowid_filter_skipped": "cost_factor <= 0",
|
||||
"rows": 1,
|
||||
"cost": 20.00585794,
|
||||
"chosen": true
|
||||
|
@ -8409,6 +8416,7 @@ JSON_DETAILED(JSON_EXTRACT(trace, '$**.considered_execution_plans'))
|
|||
"index": "a",
|
||||
"used_range_estimates": false,
|
||||
"cause": "not available",
|
||||
"rowid_filter_skipped": "cost_factor <= 0",
|
||||
"rows": 1,
|
||||
"cost": 200.0585794,
|
||||
"chosen": true
|
||||
|
|
|
@ -1907,8 +1907,19 @@ ERROR 42000: You have an error in your SQL syntax; check the manual that corresp
|
|||
EXECUTE IMMEDIATE 'CREATE PROCEDURE p() UPDATE t SET c=\'\'"abc';
|
||||
ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '"abc' at line 1
|
||||
SET @@sql_mode=@save_sql_mode;
|
||||
#
|
||||
# MDEV-30151 parse error 1=2 not between/in
|
||||
#
|
||||
select 1=2 not in (3,4);
|
||||
1=2 not in (3,4)
|
||||
1
|
||||
select 1=2 not between 3 and 4;
|
||||
1=2 not between 3 and 4
|
||||
1
|
||||
#
|
||||
# End of 10.3 tests
|
||||
#
|
||||
#
|
||||
# MDEV-19540: 10.4 allow lock options with SELECT in brackets
|
||||
# which previous version do not
|
||||
#
|
||||
|
|
|
@ -1680,7 +1680,15 @@ EXECUTE IMMEDIATE 'CREATE PROCEDURE p() UPDATE t SET c=\'\'"abc';
|
|||
|
||||
SET @@sql_mode=@save_sql_mode;
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-30151 parse error 1=2 not between/in
|
||||
--echo #
|
||||
select 1=2 not in (3,4);
|
||||
select 1=2 not between 3 and 4;
|
||||
|
||||
--echo #
|
||||
--echo # End of 10.3 tests
|
||||
--echo #
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-19540: 10.4 allow lock options with SELECT in brackets
|
||||
|
|
|
@ -338,7 +338,7 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND
|
|||
o_totalprice between 200000 and 230000;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 Using index condition
|
||||
1 SIMPLE orders eq_ref|filter PRIMARY,i_o_totalprice PRIMARY|i_o_totalprice 4|9 dbt3_s001.lineitem.l_orderkey 1 (5%) Using where; Using rowid filter
|
||||
1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where
|
||||
set statement optimizer_switch='rowid_filter=on' for EXPLAIN FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
|
||||
FROM orders JOIN lineitem ON o_orderkey=l_orderkey
|
||||
WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND
|
||||
|
@ -371,14 +371,6 @@ EXPLAIN
|
|||
"key_length": "4",
|
||||
"used_key_parts": ["o_orderkey"],
|
||||
"ref": ["dbt3_s001.lineitem.l_orderkey"],
|
||||
"rowid_filter": {
|
||||
"range": {
|
||||
"key": "i_o_totalprice",
|
||||
"used_key_parts": ["o_totalprice"]
|
||||
},
|
||||
"rows": 69,
|
||||
"selectivity_pct": 4.6
|
||||
},
|
||||
"rows": 1,
|
||||
"filtered": 4.599999905,
|
||||
"attached_condition": "orders.o_totalprice between 200000 and 230000"
|
||||
|
@ -391,7 +383,7 @@ WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND
|
|||
o_totalprice between 200000 and 230000;
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 SIMPLE lineitem range PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity i_l_shipdate 4 NULL 98 98.00 100.00 100.00 Using index condition
|
||||
1 SIMPLE orders eq_ref|filter PRIMARY,i_o_totalprice PRIMARY|i_o_totalprice 4|9 dbt3_s001.lineitem.l_orderkey 1 (5%) 0.11 (10%) 4.60 100.00 Using where; Using rowid filter
|
||||
1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 1.00 4.60 11.22 Using where
|
||||
set statement optimizer_switch='rowid_filter=on' for ANALYZE FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, o_totalprice
|
||||
FROM orders JOIN lineitem ON o_orderkey=l_orderkey
|
||||
WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-01-31' AND
|
||||
|
@ -431,26 +423,13 @@ ANALYZE
|
|||
"key_length": "4",
|
||||
"used_key_parts": ["o_orderkey"],
|
||||
"ref": ["dbt3_s001.lineitem.l_orderkey"],
|
||||
"rowid_filter": {
|
||||
"range": {
|
||||
"key": "i_o_totalprice",
|
||||
"used_key_parts": ["o_totalprice"]
|
||||
},
|
||||
"rows": 69,
|
||||
"selectivity_pct": 4.6,
|
||||
"r_rows": 71,
|
||||
"r_lookups": 96,
|
||||
"r_selectivity_pct": 10.41666667,
|
||||
"r_buffer_size": "REPLACED",
|
||||
"r_filling_time_ms": "REPLACED"
|
||||
},
|
||||
"r_loops": 98,
|
||||
"rows": 1,
|
||||
"r_rows": 0.112244898,
|
||||
"r_rows": 1,
|
||||
"r_table_time_ms": "REPLACED",
|
||||
"r_other_time_ms": "REPLACED",
|
||||
"filtered": 4.599999905,
|
||||
"r_filtered": 100,
|
||||
"r_filtered": 11.2244898,
|
||||
"attached_condition": "orders.o_totalprice between 200000 and 230000"
|
||||
}
|
||||
}
|
||||
|
@ -596,7 +575,7 @@ l_quantity > 45 AND
|
|||
o_totalprice between 180000 and 230000;
|
||||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE lineitem range|filter PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity,i_l_quantity i_l_shipdate|i_l_quantity 4|9 NULL 509 (12%) Using index condition; Using where; Using rowid filter
|
||||
1 SIMPLE orders eq_ref|filter PRIMARY,i_o_totalprice PRIMARY|i_o_totalprice 4|9 dbt3_s001.lineitem.l_orderkey 1 (9%) Using where; Using rowid filter
|
||||
1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where
|
||||
set statement optimizer_switch='rowid_filter=on' for EXPLAIN FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, l_quantity, o_totalprice
|
||||
FROM orders JOIN lineitem ON o_orderkey=l_orderkey
|
||||
WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND
|
||||
|
@ -640,14 +619,6 @@ EXPLAIN
|
|||
"key_length": "4",
|
||||
"used_key_parts": ["o_orderkey"],
|
||||
"ref": ["dbt3_s001.lineitem.l_orderkey"],
|
||||
"rowid_filter": {
|
||||
"range": {
|
||||
"key": "i_o_totalprice",
|
||||
"used_key_parts": ["o_totalprice"]
|
||||
},
|
||||
"rows": 139,
|
||||
"selectivity_pct": 9.266666667
|
||||
},
|
||||
"rows": 1,
|
||||
"filtered": 9.266666412,
|
||||
"attached_condition": "orders.o_totalprice between 180000 and 230000"
|
||||
|
@ -661,7 +632,7 @@ l_quantity > 45 AND
|
|||
o_totalprice between 180000 and 230000;
|
||||
id select_type table type possible_keys key key_len ref rows r_rows filtered r_filtered Extra
|
||||
1 SIMPLE lineitem range|filter PRIMARY,i_l_shipdate,i_l_orderkey,i_l_orderkey_quantity,i_l_quantity i_l_shipdate|i_l_quantity 4|9 NULL 509 (12%) 60.00 (11%) 11.69 100.00 Using index condition; Using where; Using rowid filter
|
||||
1 SIMPLE orders eq_ref|filter PRIMARY,i_o_totalprice PRIMARY|i_o_totalprice 4|9 dbt3_s001.lineitem.l_orderkey 1 (9%) 0.27 (25%) 9.27 100.00 Using where; Using rowid filter
|
||||
1 SIMPLE orders eq_ref PRIMARY,i_o_totalprice PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 1.00 9.27 26.67 Using where
|
||||
set statement optimizer_switch='rowid_filter=on' for ANALYZE FORMAT=JSON SELECT o_orderkey, l_linenumber, l_shipdate, l_quantity, o_totalprice
|
||||
FROM orders JOIN lineitem ON o_orderkey=l_orderkey
|
||||
WHERE l_shipdate BETWEEN '1997-01-01' AND '1997-06-30' AND
|
||||
|
@ -717,26 +688,13 @@ ANALYZE
|
|||
"key_length": "4",
|
||||
"used_key_parts": ["o_orderkey"],
|
||||
"ref": ["dbt3_s001.lineitem.l_orderkey"],
|
||||
"rowid_filter": {
|
||||
"range": {
|
||||
"key": "i_o_totalprice",
|
||||
"used_key_parts": ["o_totalprice"]
|
||||
},
|
||||
"rows": 139,
|
||||
"selectivity_pct": 9.266666667,
|
||||
"r_rows": 144,
|
||||
"r_lookups": 59,
|
||||
"r_selectivity_pct": 25.42372881,
|
||||
"r_buffer_size": "REPLACED",
|
||||
"r_filling_time_ms": "REPLACED"
|
||||
},
|
||||
"r_loops": 60,
|
||||
"rows": 1,
|
||||
"r_rows": 0.266666667,
|
||||
"r_rows": 1,
|
||||
"r_table_time_ms": "REPLACED",
|
||||
"r_other_time_ms": "REPLACED",
|
||||
"filtered": 9.266666412,
|
||||
"r_filtered": 100,
|
||||
"r_filtered": 26.66666667,
|
||||
"attached_condition": "orders.o_totalprice between 180000 and 230000"
|
||||
}
|
||||
}
|
||||
|
@ -2098,7 +2056,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 INNER JOIN t2 ON ( pk1+1 = pk2+2 AND a1 = a2 )
|
|||
WHERE b1 <= ( SELECT MAX(b2) FROM t2 WHERE pk2 <= 1 );
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 101 100.00 Using where
|
||||
1 PRIMARY t1 ref|filter a1,b1 a1|b1 5|4 test.t2.a2 36 (29%) 28.75 Using where; Using rowid filter
|
||||
1 PRIMARY t1 ref a1,b1 a1 5 test.t2.a2 36 28.75 Using where
|
||||
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 100.00 Using index condition
|
||||
Warnings:
|
||||
Note 1003 /* select#1 */ select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`pk2` AS `pk2`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a1` = `test`.`t2`.`a2` and `test`.`t1`.`b1` <= (/* select#2 */ select max(`test`.`t2`.`b2`) from `test`.`t2` where `test`.`t2`.`pk2` <= 1) and `test`.`t1`.`pk1` + 1 = `test`.`t2`.`pk2` + 2
|
||||
|
@ -2123,14 +2081,6 @@ EXPLAIN
|
|||
"key_length": "5",
|
||||
"used_key_parts": ["a1"],
|
||||
"ref": ["test.t2.a2"],
|
||||
"rowid_filter": {
|
||||
"range": {
|
||||
"key": "b1",
|
||||
"used_key_parts": ["b1"]
|
||||
},
|
||||
"rows": 115,
|
||||
"selectivity_pct": 28.75
|
||||
},
|
||||
"rows": 36,
|
||||
"filtered": 28.75,
|
||||
"attached_condition": "t1.b1 <= (subquery#2) and t1.pk1 + 1 = t2.pk2 + 2"
|
||||
|
|
|
@ -2044,7 +2044,7 @@ EXPLAIN EXTENDED SELECT * FROM t1 INNER JOIN t2 ON ( pk1+1 = pk2+2 AND a1 = a2 )
|
|||
WHERE b1 <= ( SELECT MAX(b2) FROM t2 WHERE pk2 <= 1 );
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t2 ALL NULL NULL NULL NULL 101 100.00 Using where
|
||||
1 PRIMARY t1 ref|filter a1,b1 a1|b1 5|4 test.t2.a2 36 (29%) 28.75 Using where; Using rowid filter
|
||||
1 PRIMARY t1 ref a1,b1 a1 5 test.t2.a2 36 28.75 Using where
|
||||
2 SUBQUERY t2 range PRIMARY PRIMARY 4 NULL 1 100.00 Using index condition
|
||||
Warnings:
|
||||
Note 1003 /* select#1 */ select `test`.`t1`.`pk1` AS `pk1`,`test`.`t1`.`a1` AS `a1`,`test`.`t1`.`b1` AS `b1`,`test`.`t2`.`pk2` AS `pk2`,`test`.`t2`.`a2` AS `a2`,`test`.`t2`.`b2` AS `b2` from `test`.`t1` join `test`.`t2` where `test`.`t1`.`a1` = `test`.`t2`.`a2` and `test`.`t1`.`b1` <= (/* select#2 */ select max(`test`.`t2`.`b2`) from `test`.`t2` where `test`.`t2`.`pk2` <= 1) and `test`.`t1`.`pk1` + 1 = `test`.`t2`.`pk2` + 2
|
||||
|
@ -2069,14 +2069,6 @@ EXPLAIN
|
|||
"key_length": "5",
|
||||
"used_key_parts": ["a1"],
|
||||
"ref": ["test.t2.a2"],
|
||||
"rowid_filter": {
|
||||
"range": {
|
||||
"key": "b1",
|
||||
"used_key_parts": ["b1"]
|
||||
},
|
||||
"rows": 115,
|
||||
"selectivity_pct": 28.75
|
||||
},
|
||||
"rows": 36,
|
||||
"filtered": 28.75,
|
||||
"attached_condition": "t1.b1 <= (subquery#2) and t1.pk1 + 1 = t2.pk2 + 2"
|
||||
|
@ -2717,7 +2709,7 @@ id y x
|
|||
explain extended select * from t1 join t2 on t1.id = t2.x where t2.y = 2 and t1.id = 1;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1 100.00 Using index
|
||||
1 SIMPLE t2 ref x,y y 5 const 2 100.00 Using where
|
||||
1 SIMPLE t2 index_merge x,y y,x 5,5 NULL 1 100.00 Using intersect(y,x); Using where; Using index
|
||||
Warnings:
|
||||
Note 1003 select 1 AS `id`,`test`.`t2`.`y` AS `y`,`test`.`t2`.`x` AS `x` from `test`.`t1` join `test`.`t2` where `test`.`t2`.`y` = 2 and `test`.`t2`.`x` = 1
|
||||
drop table t1, t2;
|
||||
|
@ -2754,7 +2746,7 @@ count(*)
|
|||
5
|
||||
explain extended select count(*) from t1 where a between 21 and 30 and b=2;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ref|filter b,a b|a 5|5 const 24 (10%) 9.60 Using where; Using rowid filter
|
||||
1 SIMPLE t1 ref b,a b 5 const 24 9.60 Using where
|
||||
Warnings:
|
||||
Note 1003 select count(0) AS `count(*)` from `test`.`t1` where `test`.`t1`.`b` = 2 and `test`.`t1`.`a` between 21 and 30
|
||||
select * from t1 where a between 21 and 30 and b=2;
|
||||
|
@ -3465,7 +3457,7 @@ fi.fh in (6311439873746261694,-397087483897438286,
|
|||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t index_merge PRIMARY,acli_rid,acli_tp acli_tp,acli_rid 2,767 NULL 2 100.00 Using intersect(acli_tp,acli_rid); Using where; Using index
|
||||
1 SIMPLE a ref PRIMARY,acei_aclid acei_aclid 8 test.t.id 1 100.00 Using where
|
||||
1 SIMPLE fi ref|filter filt_aceid,filt_fh filt_aceid|filt_fh 8|8 test.a.id 24 (14%) 14.46 Using where; Using rowid filter
|
||||
1 SIMPLE fi ref filt_aceid,filt_fh filt_aceid 8 test.a.id 24 14.46 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t`.`id` AS `id`,`test`.`fi`.`id` AS `id`,`test`.`fi`.`aceid` AS `aceid`,`test`.`fi`.`clid` AS `clid`,`test`.`fi`.`fh` AS `fh` from `test`.`acli` `t` join `test`.`acei` `a` join `test`.`filt` `fi` where `test`.`t`.`tp` = 121 and `test`.`a`.`atp` = 1 and `test`.`fi`.`aceid` = `test`.`a`.`id` and `test`.`a`.`aclid` = `test`.`t`.`id` and `test`.`t`.`rid` = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and `test`.`fi`.`fh` in (6311439873746261694,-397087483897438286,8518228073041491534,-5420422472375069774)
|
||||
set statement optimizer_switch='rowid_filter=on' for select t.id, fi.*
|
||||
|
@ -3581,7 +3573,7 @@ fi.fh in (6311439873746261694,-397087483897438286,
|
|||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t index_merge PRIMARY,acli_rid,acli_tp acli_tp,acli_rid 2,767 NULL 2 100.00 Using intersect(acli_tp,acli_rid); Using where; Using index
|
||||
1 SIMPLE a ref PRIMARY,acei_aclid acei_aclid 8 test.t.id 1 100.00 Using where; Using join buffer (flat, BKA join); Rowid-ordered scan
|
||||
1 SIMPLE fi ref|filter filt_aceid,filt_fh filt_aceid|filt_fh 8|8 test.a.id 24 (14%) 14.46 Using where; Using join buffer (incremental, BKA join); Rowid-ordered scan; Using rowid filter
|
||||
1 SIMPLE fi ref filt_aceid,filt_fh filt_aceid 8 test.a.id 24 14.46 Using where; Using join buffer (incremental, BKA join); Rowid-ordered scan
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t`.`id` AS `id`,`test`.`fi`.`id` AS `id`,`test`.`fi`.`aceid` AS `aceid`,`test`.`fi`.`clid` AS `clid`,`test`.`fi`.`fh` AS `fh` from `test`.`acli` `t` join `test`.`acei` `a` join `test`.`filt` `fi` where `test`.`t`.`tp` = 121 and `test`.`a`.`atp` = 1 and `test`.`fi`.`aceid` = `test`.`a`.`id` and `test`.`a`.`aclid` = `test`.`t`.`id` and `test`.`t`.`rid` = 'B5FCC8C7111E4E3CBC21AAF5012F59C2' and `test`.`fi`.`fh` in (6311439873746261694,-397087483897438286,8518228073041491534,-5420422472375069774)
|
||||
set statement optimizer_switch='rowid_filter=on' for select t.id, fi.*
|
||||
|
@ -3701,22 +3693,9 @@ ANALYZE
|
|||
"key_length": "8",
|
||||
"used_key_parts": ["aceid"],
|
||||
"ref": ["test.a.id"],
|
||||
"rowid_filter": {
|
||||
"range": {
|
||||
"key": "filt_fh",
|
||||
"used_key_parts": ["fh"]
|
||||
},
|
||||
"rows": 81,
|
||||
"selectivity_pct": 14.46428571,
|
||||
"r_rows": 80,
|
||||
"r_lookups": 80,
|
||||
"r_selectivity_pct": 40,
|
||||
"r_buffer_size": "REPLACED",
|
||||
"r_filling_time_ms": "REPLACED"
|
||||
},
|
||||
"r_loops": 1,
|
||||
"rows": 24,
|
||||
"r_rows": 32,
|
||||
"r_rows": 80,
|
||||
"r_table_time_ms": "REPLACED",
|
||||
"r_other_time_ms": "REPLACED",
|
||||
"filtered": 14.46428585,
|
||||
|
@ -3727,7 +3706,7 @@ ANALYZE
|
|||
"join_type": "BKA",
|
||||
"mrr_type": "Rowid-ordered scan",
|
||||
"attached_condition": "fi.fh in (6311439873746261694,-397087483897438286,8518228073041491534,-5420422472375069774)",
|
||||
"r_filtered": 100
|
||||
"r_filtered": 40
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3831,7 +3810,7 @@ WHERE t1.c1 NOT IN (SELECT t2.c1 FROM t2, t1 AS a1
|
|||
WHERE t2.i1 = t1.pk AND t2.i1 BETWEEN 3 AND 5);
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 PRIMARY t1 ALL NULL NULL NULL NULL 60 100.00 Using where
|
||||
2 DEPENDENT SUBQUERY t2 ref|filter c1,i1 c1|i1 3|5 func 38 (25%) 25.00 Using where; Full scan on NULL key; Using rowid filter
|
||||
2 DEPENDENT SUBQUERY t2 ref c1,i1 i1 5 test.t1.pk 20 100.00 Using index condition; Using where
|
||||
2 DEPENDENT SUBQUERY a1 ALL NULL NULL NULL NULL 60 100.00 Using join buffer (flat, BNL join)
|
||||
Warnings:
|
||||
Note 1276 Field or reference 'test.t1.pk' of SELECT #2 was resolved in SELECT #1
|
||||
|
|
|
@ -48,29 +48,3 @@ ERROR 70100: Query execution was interrupted
|
|||
set debug_sync='RESET';
|
||||
drop table t2,t3;
|
||||
set default_storage_engine=default;
|
||||
set @save_optimizer_switch= @@optimizer_switch;
|
||||
set @save_use_stat_tables= @@use_stat_tables;
|
||||
set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
|
||||
set @@use_stat_tables=preferably;
|
||||
set optimizer_use_condition_selectivity=2;
|
||||
set optimizer_switch='rowid_filter=on';
|
||||
#
|
||||
# MDEV-22761 KILL QUERY during rowid_filter, crashes
|
||||
# (The smaller testcase)
|
||||
#
|
||||
CREATE TABLE t1 (a INT, b INT, INDEX(a), INDEX(b)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (0,0),(1,0),(-1,1), (-2,1), (-2,3), (-3,4), (-2,4);
|
||||
set debug_sync='handler_rowid_filter_check SIGNAL killme WAIT_FOR go';
|
||||
SELECT * FROM t1 WHERE a > 0 AND b=0;
|
||||
connect con1, localhost, root,,;
|
||||
set debug_sync='now WAIT_FOR killme';
|
||||
kill query @id;
|
||||
set debug_sync='now SIGNAL go';
|
||||
connection default;
|
||||
ERROR 70100: Query execution was interrupted
|
||||
set debug_sync='RESET';
|
||||
disconnect con1;
|
||||
drop table t1;
|
||||
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
|
||||
set @@optimizer_switch=@save_optimizer_switch;
|
||||
set @@use_stat_tables=@save_use_stat_tables;
|
||||
|
|
|
@ -5,47 +5,3 @@ set default_storage_engine=innodb;
|
|||
--source include/rowid_filter_debug_kill.inc
|
||||
set default_storage_engine=default;
|
||||
|
||||
--source include/default_optimizer_switch.inc
|
||||
--source include/count_sessions.inc
|
||||
|
||||
set @save_optimizer_switch= @@optimizer_switch;
|
||||
set @save_use_stat_tables= @@use_stat_tables;
|
||||
set @save_optimizer_use_condition_selectivity= @@optimizer_use_condition_selectivity;
|
||||
|
||||
set @@use_stat_tables=preferably;
|
||||
|
||||
set optimizer_use_condition_selectivity=2;
|
||||
set optimizer_switch='rowid_filter=on';
|
||||
|
||||
--echo #
|
||||
--echo # MDEV-22761 KILL QUERY during rowid_filter, crashes
|
||||
--echo # (The smaller testcase)
|
||||
--echo #
|
||||
|
||||
CREATE TABLE t1 (a INT, b INT, INDEX(a), INDEX(b)) ENGINE=InnoDB;
|
||||
INSERT INTO t1 VALUES (0,0),(1,0),(-1,1), (-2,1), (-2,3), (-3,4), (-2,4);
|
||||
|
||||
let $ID= `SELECT @id := CONNECTION_ID()`;
|
||||
|
||||
set debug_sync='handler_rowid_filter_check SIGNAL killme WAIT_FOR go';
|
||||
send SELECT * FROM t1 WHERE a > 0 AND b=0;
|
||||
|
||||
connect (con1, localhost, root,,);
|
||||
let $ignore= `SELECT @id := $ID`;
|
||||
set debug_sync='now WAIT_FOR killme';
|
||||
kill query @id;
|
||||
set debug_sync='now SIGNAL go';
|
||||
|
||||
connection default;
|
||||
--error ER_QUERY_INTERRUPTED
|
||||
reap;
|
||||
set debug_sync='RESET';
|
||||
|
||||
disconnect con1;
|
||||
drop table t1;
|
||||
|
||||
set @@optimizer_use_condition_selectivity=@save_optimizer_use_condition_selectivity;
|
||||
set @@optimizer_switch=@save_optimizer_switch;
|
||||
set @@use_stat_tables=@save_use_stat_tables;
|
||||
|
||||
--source include/wait_until_count_sessions.inc
|
||||
|
|
|
@ -3616,7 +3616,7 @@ t3.a=t2.a AND t3.c IN ('bb','ee');
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
||||
1 SIMPLE t2 range si si 5 NULL 4 Using index condition; Using where
|
||||
1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter
|
||||
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
||||
EXPLAIN
|
||||
SELECT t3.a FROM t1,t2,t3
|
||||
WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND
|
||||
|
@ -3624,7 +3624,7 @@ t3.a=t2.a AND t3.c IN ('bb','ee') ;
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
||||
1 SIMPLE t2 range si,ai si 5 NULL 4 Using index condition; Using where
|
||||
1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter
|
||||
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
||||
EXPLAIN
|
||||
SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3
|
||||
WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND
|
||||
|
@ -3632,7 +3632,7 @@ t3.c IN ('bb','ee');
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
||||
1 SIMPLE t2 range si si 5 NULL 2 Using index condition; Using where
|
||||
1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter
|
||||
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
||||
EXPLAIN
|
||||
SELECT t3.a FROM t1,t2,t3
|
||||
WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND
|
||||
|
@ -3640,7 +3640,7 @@ t3.c IN ('bb','ee');
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
||||
1 SIMPLE t2 range si,ai si 5 NULL 2 Using index condition; Using where
|
||||
1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter
|
||||
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
||||
DROP TABLE t1,t2,t3;
|
||||
CREATE TABLE t1 ( f1 int primary key, f2 int, f3 int, f4 int, f5 int, f6 int, checked_out int);
|
||||
CREATE TABLE t2 ( f11 int PRIMARY KEY );
|
||||
|
|
|
@ -3627,7 +3627,7 @@ t3.a=t2.a AND t3.c IN ('bb','ee');
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
||||
1 SIMPLE t2 range si si 5 NULL 4 Using index condition; Using where; Rowid-ordered scan
|
||||
1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter
|
||||
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
|
||||
EXPLAIN
|
||||
SELECT t3.a FROM t1,t2,t3
|
||||
WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND
|
||||
|
@ -3635,7 +3635,7 @@ t3.a=t2.a AND t3.c IN ('bb','ee') ;
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
||||
1 SIMPLE t2 range si,ai si 5 NULL 4 Using index condition; Using where; Rowid-ordered scan
|
||||
1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter
|
||||
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
|
||||
EXPLAIN
|
||||
SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3
|
||||
WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND
|
||||
|
@ -3643,7 +3643,7 @@ t3.c IN ('bb','ee');
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
||||
1 SIMPLE t2 range si si 5 NULL 2 Using index condition; Using where; Rowid-ordered scan
|
||||
1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter
|
||||
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
|
||||
EXPLAIN
|
||||
SELECT t3.a FROM t1,t2,t3
|
||||
WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND
|
||||
|
@ -3651,7 +3651,7 @@ t3.c IN ('bb','ee');
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
||||
1 SIMPLE t2 range si,ai si 5 NULL 2 Using index condition; Using where; Rowid-ordered scan
|
||||
1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan; Using rowid filter
|
||||
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where; Using join buffer (flat, BKA join); Key-ordered Rowid-ordered scan
|
||||
DROP TABLE t1,t2,t3;
|
||||
CREATE TABLE t1 ( f1 int primary key, f2 int, f3 int, f4 int, f5 int, f6 int, checked_out int);
|
||||
CREATE TABLE t2 ( f11 int PRIMARY KEY );
|
||||
|
|
|
@ -3616,7 +3616,7 @@ t3.a=t2.a AND t3.c IN ('bb','ee');
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
||||
1 SIMPLE t2 range si si 5 NULL 4 Using index condition; Using where
|
||||
1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter
|
||||
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
||||
EXPLAIN
|
||||
SELECT t3.a FROM t1,t2,t3
|
||||
WHERE t1.id = 8 AND t2.i BETWEEN t1.b AND t1.e AND
|
||||
|
@ -3624,7 +3624,7 @@ t3.a=t2.a AND t3.c IN ('bb','ee') ;
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
||||
1 SIMPLE t2 range si,ai si 5 NULL 4 Using index condition; Using where
|
||||
1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter
|
||||
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
||||
EXPLAIN
|
||||
SELECT t3.a FROM t1,t2 FORCE INDEX (si),t3
|
||||
WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND
|
||||
|
@ -3632,7 +3632,7 @@ t3.c IN ('bb','ee');
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
||||
1 SIMPLE t2 range si si 5 NULL 2 Using index condition; Using where
|
||||
1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter
|
||||
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
||||
EXPLAIN
|
||||
SELECT t3.a FROM t1,t2,t3
|
||||
WHERE t1.id = 8 AND (t2.i=t1.b OR t2.i=t1.e) AND t3.a=t2.a AND
|
||||
|
@ -3640,7 +3640,7 @@ t3.c IN ('bb','ee');
|
|||
id select_type table type possible_keys key key_len ref rows Extra
|
||||
1 SIMPLE t1 const PRIMARY PRIMARY 4 const 1
|
||||
1 SIMPLE t2 range si,ai si 5 NULL 2 Using index condition; Using where
|
||||
1 SIMPLE t3 eq_ref|filter PRIMARY,ci PRIMARY|ci 4|5 test.t2.a 1 (30%) Using where; Using rowid filter
|
||||
1 SIMPLE t3 eq_ref PRIMARY,ci PRIMARY 4 test.t2.a 1 Using where
|
||||
DROP TABLE t1,t2,t3;
|
||||
CREATE TABLE t1 ( f1 int primary key, f2 int, f3 int, f4 int, f5 int, f6 int, checked_out int);
|
||||
CREATE TABLE t2 ( f11 int PRIMARY KEY );
|
||||
|
|
|
@ -1661,7 +1661,7 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`
|
|||
# gives selectivity data
|
||||
explain extended select * from t1 where a in (17,51,5) and b=2;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ref|filter b,a b|a 5|5 const 24 (3%) 2.90 Using where; Using rowid filter
|
||||
1 SIMPLE t1 ref b,a b 5 const 24 2.90 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = 2 and `test`.`t1`.`a` in (17,51,5)
|
||||
drop table t1;
|
||||
|
|
|
@ -1671,7 +1671,7 @@ Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1`
|
|||
# gives selectivity data
|
||||
explain extended select * from t1 where a in (17,51,5) and b=2;
|
||||
id select_type table type possible_keys key key_len ref rows filtered Extra
|
||||
1 SIMPLE t1 ref|filter b,a b|a 5|5 const 24 (3%) 2.90 Using where; Using rowid filter
|
||||
1 SIMPLE t1 ref b,a b 5 const 24 2.90 Using where
|
||||
Warnings:
|
||||
Note 1003 select `test`.`t1`.`a` AS `a`,`test`.`t1`.`b` AS `b` from `test`.`t1` where `test`.`t1`.`b` = 2 and `test`.`t1`.`a` in (17,51,5)
|
||||
drop table t1;
|
||||
|
|
|
@ -216,8 +216,8 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||
1 SIMPLE part ALL PRIMARY NULL NULL NULL 200 Using where; Using join buffer (flat, BNL join)
|
||||
1 SIMPLE lineitem ref PRIMARY,i_l_suppkey_partkey,i_l_partkey,i_l_suppkey,i_l_orderkey,i_l_orderkey_quantity i_l_partkey 5 dbt3_s001.part.p_partkey 30 Using where
|
||||
1 SIMPLE supplier eq_ref PRIMARY,i_s_nationkey PRIMARY 4 dbt3_s001.lineitem.l_suppkey 1 Using where
|
||||
1 SIMPLE orders eq_ref|filter PRIMARY,i_o_orderdate,i_o_custkey PRIMARY|i_o_orderdate 4|4 dbt3_s001.lineitem.l_orderkey 1 (27%) Using where; Using rowid filter
|
||||
1 SIMPLE n2 eq_ref PRIMARY PRIMARY 4 dbt3_s001.supplier.s_nationkey 1
|
||||
1 SIMPLE orders eq_ref PRIMARY,i_o_orderdate,i_o_custkey PRIMARY 4 dbt3_s001.lineitem.l_orderkey 1 Using where
|
||||
1 SIMPLE customer eq_ref PRIMARY,i_c_nationkey PRIMARY 4 dbt3_s001.orders.o_custkey 1 Using where
|
||||
1 SIMPLE n1 eq_ref PRIMARY,i_n_regionkey PRIMARY 4 dbt3_s001.customer.c_nationkey 1 Using where
|
||||
select o_year,
|
||||
|
|
|
@ -132,7 +132,7 @@ id select_type table type possible_keys key key_len ref rows Extra
|
|||
1 PRIMARY t3 eq_ref PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 test.t3.PARENTID 1 Using where
|
||||
1 PRIMARY t3 eq_ref PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 test.t3.PARENTID 1 Using where
|
||||
1 PRIMARY t3 eq_ref PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 test.t3.PARENTID 1 Using where
|
||||
1 PRIMARY t3 ref|filter PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX FFOLDERID_IDX|CMFLDRPARNT_IDX 34|35 test.t3.PARENTID 1 (29%) Using where; Using rowid filter
|
||||
1 PRIMARY t3 eq_ref PRIMARY,FFOLDERID_IDX,CMFLDRPARNT_IDX PRIMARY 34 test.t3.PARENTID 1 Using where
|
||||
drop table t1, t2, t3, t4;
|
||||
CREATE TABLE t1 (a int(10) , PRIMARY KEY (a)) Engine=InnoDB;
|
||||
INSERT INTO t1 VALUES (1),(2);
|
||||
|
|
|
@ -6730,7 +6730,9 @@ DROP TABLE t1;
|
|||
#
|
||||
# MDEV-24314: create view with derived table without default database
|
||||
#
|
||||
drop database test;
|
||||
create database dummy;
|
||||
use dummy;
|
||||
drop database dummy;
|
||||
create database db1;
|
||||
create table db1.t1 (a int);
|
||||
insert into db1.t1 values (3),(7),(1);
|
||||
|
@ -6760,7 +6762,6 @@ a
|
|||
drop view db1.v1;
|
||||
drop table db1.t1;
|
||||
drop database db1;
|
||||
create database test;
|
||||
use test;
|
||||
#
|
||||
# MDEV-16940: update of multi-table view returning error used in SP
|
||||
|
|
|
@ -6426,7 +6426,9 @@ DROP TABLE t1;
|
|||
--echo # MDEV-24314: create view with derived table without default database
|
||||
--echo #
|
||||
|
||||
drop database test;
|
||||
create database dummy;
|
||||
use dummy;
|
||||
drop database dummy;
|
||||
|
||||
create database db1;
|
||||
create table db1.t1 (a int);
|
||||
|
@ -6449,7 +6451,6 @@ drop view db1.v1;
|
|||
drop table db1.t1;
|
||||
drop database db1;
|
||||
|
||||
create database test;
|
||||
use test;
|
||||
|
||||
--echo #
|
||||
|
|
|
@ -1813,7 +1813,7 @@ sub collect_mysqld_features_from_running_server ()
|
|||
|
||||
sub find_mysqld {
|
||||
|
||||
my ($mysqld_basedir)= $ENV{MTR_BINDIR}|| @_;
|
||||
my ($mysqld_basedir)= $ENV{MTR_BINDIR_FORCED} || $ENV{MTR_BINDIR} || @_;
|
||||
|
||||
my @mysqld_names= ("mariadbd", "mysqld", "mysqld-max-nt", "mysqld-max",
|
||||
"mysqld-nt");
|
||||
|
@ -1824,7 +1824,7 @@ sub find_mysqld {
|
|||
unshift(@mysqld_names, "mysqld-debug");
|
||||
}
|
||||
|
||||
return my_find_bin($bindir,
|
||||
return my_find_bin($mysqld_basedir,
|
||||
["sql", "libexec", "sbin", "bin"],
|
||||
[@mysqld_names]);
|
||||
}
|
||||
|
@ -4693,6 +4693,7 @@ sub check_expected_crash_and_restart {
|
|||
mtr_verbose("Test says wait before restart") if $waits == 0;
|
||||
next;
|
||||
}
|
||||
delete $ENV{MTR_BINDIR_FORCED};
|
||||
|
||||
# Ignore any partial or unknown command
|
||||
next unless $last_line =~ /^restart/;
|
||||
|
@ -4700,7 +4701,13 @@ sub check_expected_crash_and_restart {
|
|||
# extra command line options to add to the restarted mysqld.
|
||||
# Anything other than 'wait' or 'restart:' (with a colon) will
|
||||
# result in a restart with original mysqld options.
|
||||
if ($last_line =~ /restart:(.+)/) {
|
||||
if ($last_line =~ /restart_bindir\s+(\S+)(:.+)?/) {
|
||||
$ENV{MTR_BINDIR_FORCED}= $1;
|
||||
if ($2) {
|
||||
my @rest_opt= split(' ', $2);
|
||||
$mysqld->{'restart_opts'}= \@rest_opt;
|
||||
}
|
||||
} elsif ($last_line =~ /restart:(.+)/) {
|
||||
my @rest_opt= split(' ', $1);
|
||||
$mysqld->{'restart_opts'}= \@rest_opt;
|
||||
} else {
|
||||
|
|
BIN
mysql-test/std_data/versioning/articles.frm.gz
Normal file
BIN
mysql-test/std_data/versioning/articles.frm.gz
Normal file
Binary file not shown.
BIN
mysql-test/std_data/versioning/articles2.frm.gz
Normal file
BIN
mysql-test/std_data/versioning/articles2.frm.gz
Normal file
Binary file not shown.
BIN
mysql-test/std_data/versioning/ibdata1.gz
Normal file
BIN
mysql-test/std_data/versioning/ibdata1.gz
Normal file
Binary file not shown.
BIN
mysql-test/std_data/versioning/user_stopword.frm.gz
Normal file
BIN
mysql-test/std_data/versioning/user_stopword.frm.gz
Normal file
Binary file not shown.
|
@ -1,3 +1,4 @@
|
|||
SET GLOBAL innodb_max_purge_lag_wait=0;
|
||||
set @save_character_set_database= @@character_set_database;
|
||||
DROP TABLE IF EXISTS test.t1;
|
||||
SET NAMES armscii8;
|
||||
|
|
|
@ -9,6 +9,10 @@
|
|||
--source include/no_valgrind_without_big.inc
|
||||
--source include/have_innodb.inc
|
||||
|
||||
# Starting with MariaDB 10.6, ensure that DDL recovery will have completed
|
||||
# before DROP DATABASE test.
|
||||
SET GLOBAL innodb_max_purge_lag_wait=0;
|
||||
|
||||
let $engine_type= InnoDB;
|
||||
--source suite/funcs_2/charset/charset_master.test
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ create table t1 (a int, b int generated always as (stddev_pop(a)) virtual);
|
|||
ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b`
|
||||
# STDDEV_SAMP()
|
||||
create table t1 (a int, b int generated always as (stddev_samp(a)) virtual);
|
||||
ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b`
|
||||
ERROR HY000: Function or expression 'stddev_samp()' cannot be used in the GENERATED ALWAYS AS clause of `b`
|
||||
# STDDEV()
|
||||
create table t1 (a int, b int generated always as (stddev(a)) virtual);
|
||||
ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b`
|
||||
|
|
|
@ -131,7 +131,7 @@ create table t1 (a int, b int generated always as (stddev_pop(a)) virtual);
|
|||
ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b`
|
||||
# STDDEV_SAMP()
|
||||
create table t1 (a int, b int generated always as (stddev_samp(a)) virtual);
|
||||
ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b`
|
||||
ERROR HY000: Function or expression 'stddev_samp()' cannot be used in the GENERATED ALWAYS AS clause of `b`
|
||||
# STDDEV()
|
||||
create table t1 (a int, b int generated always as (stddev(a)) virtual);
|
||||
ERROR HY000: Function or expression 'std()' cannot be used in the GENERATED ALWAYS AS clause of `b`
|
||||
|
|
|
@ -11,6 +11,7 @@ SET DEBUG_SYNC = 'lock_wait_suspend_thread_enter SIGNAL first_ins_locked';
|
|||
SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL first_ins_row_inserted WAIT_FOR first_ins_cont';
|
||||
INSERT INTO t VALUES(10, 20);
|
||||
connect con_del_2,localhost,root,,;
|
||||
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR first_ins_locked';
|
||||
SET DEBUG_SYNC = 'lock_wait_suspend_thread_enter SIGNAL second_del_locked';
|
||||
DELETE FROM t WHERE b = 20;
|
||||
|
|
|
@ -290,6 +290,7 @@ select count(*) > -1 from d_trx;
|
|||
count(*) > -1
|
||||
1
|
||||
connection default;
|
||||
SET GLOBAL innodb_max_purge_lag_wait=0;
|
||||
drop database test;
|
||||
create database test;
|
||||
drop user select_only@localhost;
|
||||
|
|
35
mysql-test/suite/innodb/r/insert-before-delete.result
Normal file
35
mysql-test/suite/innodb/r/insert-before-delete.result
Normal file
|
@ -0,0 +1,35 @@
|
|||
connect pause_purge,localhost,root;
|
||||
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
||||
connection default;
|
||||
CREATE TABLE t (pk int PRIMARY KEY, sk INT UNIQUE) ENGINE=InnoDB;
|
||||
INSERT INTO t VALUES (10, 100);
|
||||
connect con1,localhost,root;
|
||||
BEGIN;
|
||||
SELECT * FROM t WHERE sk = 100 FOR UPDATE;
|
||||
pk sk
|
||||
10 100
|
||||
connect con2,localhost,root;
|
||||
SET DEBUG_SYNC="lock_wait_suspend_thread_enter SIGNAL insert_wait_started";
|
||||
INSERT INTO t VALUES (5, 100) # trx 1;
|
||||
connect con3,localhost,root;
|
||||
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
|
||||
SET DEBUG_SYNC="now WAIT_FOR insert_wait_started";
|
||||
SET DEBUG_SYNC="lock_wait_suspend_thread_enter SIGNAL delete_started_waiting";
|
||||
DELETE FROM t WHERE sk = 100 # trx 2;
|
||||
connection con1;
|
||||
SET DEBUG_SYNC="now WAIT_FOR delete_started_waiting";
|
||||
DELETE FROM t WHERE sk=100;
|
||||
COMMIT;
|
||||
disconnect con1;
|
||||
connection con2;
|
||||
disconnect con2;
|
||||
connection con3;
|
||||
ERROR 40001: Deadlock found when trying to get lock; try restarting transaction
|
||||
disconnect con3;
|
||||
connection default;
|
||||
SELECT * FROM t;
|
||||
pk sk
|
||||
5 100
|
||||
disconnect pause_purge;
|
||||
SET DEBUG_SYNC="RESET";
|
||||
DROP TABLE t;
|
|
@ -702,7 +702,7 @@ SET @end = (SELECT COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME
|
|||
= 'lock_rec_lock_created');
|
||||
SELECT @end - @start;
|
||||
@end - @start
|
||||
0
|
||||
1
|
||||
# Records must not be S/X-locked if a table is X-locked.
|
||||
SET @start = @end;
|
||||
SET autocommit = 0;
|
||||
|
|
|
@ -27,6 +27,10 @@ SET DEBUG_SYNC = 'ib_after_row_insert SIGNAL first_ins_row_inserted WAIT_FOR fir
|
|||
--send INSERT INTO t VALUES(10, 20)
|
||||
|
||||
--connect(con_del_2,localhost,root,,)
|
||||
# After MDEV-30225 is fixed, the following DELETE creates next-key lock for
|
||||
# unqique search for RR, and the above INSERT kills it as deadlock victim.
|
||||
# But it still requests not-gap lock for RC.
|
||||
SET TRANSACTION ISOLATION LEVEL READ COMMITTED;
|
||||
SET DEBUG_SYNC = 'now WAIT_FOR first_ins_locked';
|
||||
SET DEBUG_SYNC = 'lock_wait_suspend_thread_enter SIGNAL second_del_locked';
|
||||
###############################################################################
|
||||
|
|
|
@ -297,6 +297,8 @@ select count(*) > -1 from i_trx;
|
|||
select count(*) > -1 from d_trx;
|
||||
|
||||
connection default;
|
||||
# Starting with MariaDB 10.6, ensure that DDL recovery will have completed.
|
||||
SET GLOBAL innodb_max_purge_lag_wait=0;
|
||||
drop database test;
|
||||
create database test;
|
||||
drop user select_only@localhost;
|
||||
|
|
|
@ -31,6 +31,8 @@ RENAME TABLE t1 TO `t2_new..............................................end`;
|
|||
show warnings;
|
||||
drop table t1;
|
||||
|
||||
# Starting with MariaDB 10.6, ensure that DDL recovery will have completed.
|
||||
SET GLOBAL innodb_max_purge_lag_wait=0;
|
||||
drop database test;
|
||||
create database test;
|
||||
use test;
|
||||
|
|
72
mysql-test/suite/innodb/t/insert-before-delete.test
Normal file
72
mysql-test/suite/innodb/t/insert-before-delete.test
Normal file
|
@ -0,0 +1,72 @@
|
|||
--source include/have_innodb.inc
|
||||
--source include/have_debug.inc
|
||||
--source include/have_debug_sync.inc
|
||||
--source include/count_sessions.inc
|
||||
|
||||
--connect (pause_purge,localhost,root)
|
||||
START TRANSACTION WITH CONSISTENT SNAPSHOT;
|
||||
|
||||
--connection default
|
||||
CREATE TABLE t (pk int PRIMARY KEY, sk INT UNIQUE) ENGINE=InnoDB;
|
||||
INSERT INTO t VALUES (10, 100);
|
||||
|
||||
--connect (con1,localhost,root)
|
||||
BEGIN; # trx 0
|
||||
SELECT * FROM t WHERE sk = 100 FOR UPDATE;
|
||||
|
||||
--connect (con2,localhost,root)
|
||||
SET DEBUG_SYNC="lock_wait_suspend_thread_enter SIGNAL insert_wait_started";
|
||||
# trx 1 is locked on try to read the record in secondary index during duplicates
|
||||
# check. It's the first in waiting queue, that's why it will be woken up firstly
|
||||
# when trx 0 commits.
|
||||
--send INSERT INTO t VALUES (5, 100) # trx 1
|
||||
|
||||
--connect (con3,localhost,root)
|
||||
# MDEV-30225 is fixed only for RR
|
||||
SET TRANSACTION ISOLATION LEVEL REPEATABLE READ;
|
||||
SET DEBUG_SYNC="now WAIT_FOR insert_wait_started";
|
||||
SET DEBUG_SYNC="lock_wait_suspend_thread_enter SIGNAL delete_started_waiting";
|
||||
# trx 2 can delete (5, 100) on master, but not on slave, as on slave trx 1
|
||||
# can insert (5, 100) after trx 2 positioned it's cursor. Trx 2 lock is placed
|
||||
# in waiting queue after trx 1 lock, but its persistent cursor position was
|
||||
# stored on (100, 10) record in secondary index before suspending. After trx 1
|
||||
# is committed, trx 2 will restore persistent cursor position on (100, 10). As
|
||||
# (100, 5) secondary index record was inserted before (100, 10) in logical
|
||||
# order, and (100, 10) record is delete-marked, trx 2 just continues scanning.
|
||||
#
|
||||
# Note. There can be several records with the same key in unique secondary
|
||||
# index, but only one of them must be non-delete-marked. That's why when we do
|
||||
# point query, cursor position is set in the first record in logical order, and
|
||||
# then records are iterated until either non-delete-marked record is found or
|
||||
# all records with the same unique fields are iterated.
|
||||
--send DELETE FROM t WHERE sk = 100 # trx 2
|
||||
|
||||
--connection con1
|
||||
SET DEBUG_SYNC="now WAIT_FOR delete_started_waiting";
|
||||
DELETE FROM t WHERE sk=100; # trx 0
|
||||
COMMIT;
|
||||
--disconnect con1
|
||||
|
||||
--connection con2
|
||||
--reap
|
||||
--disconnect con2
|
||||
|
||||
--connection con3
|
||||
# If the bug is fixed, deadlock error will be there, as trx 2 owns
|
||||
# next-key lock waiting for trx 1, and trx 1 requests
|
||||
# insert-intention lock, conflicting with trx 2 next-key lock.
|
||||
--error ER_LOCK_DEADLOCK
|
||||
--reap
|
||||
--disconnect con3
|
||||
|
||||
--connection default
|
||||
# If the bug is not fixed, we will see the row inserted by trx 1 here. This can
|
||||
# cause duplicate key error on slave, when some other trx tries in insert row
|
||||
# with the same secondary key, as was inserted by trx 1, and not deleted by trx
|
||||
# 2.
|
||||
SELECT * FROM t;
|
||||
|
||||
--disconnect pause_purge
|
||||
SET DEBUG_SYNC="RESET";
|
||||
DROP TABLE t;
|
||||
--source include/wait_until_count_sessions.inc
|
|
@ -486,6 +486,9 @@ INSERT INTO t1 VALUES(1,1,'a'),(2,9999,'b'),(3,10000,'c'),(4,4,'d');
|
|||
DELETE FROM t1 WHERE a = 9999 AND b='b';
|
||||
COMMIT;
|
||||
|
||||
# After MDEV-30225 is fixed, the above DELETE creates next-key lock during
|
||||
# secondary index unique search. That's why the result of the following must
|
||||
# be 1.
|
||||
SET @end = (SELECT COUNT FROM INFORMATION_SCHEMA.INNODB_METRICS WHERE NAME
|
||||
= 'lock_rec_lock_created');
|
||||
SELECT @end - @start;
|
||||
|
|
|
@ -5,12 +5,6 @@ body TEXT,
|
|||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
ERROR HY000: Cannot create FULLTEXT index on temporary InnoDB table
|
||||
CREATE TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL Tutorial','DBMS stands for DataBase ...') ,
|
||||
('How To Use MySQL Well','After you went through a ...'),
|
||||
|
|
|
@ -1,761 +0,0 @@
|
|||
select * from information_schema.innodb_ft_default_stopword;
|
||||
value
|
||||
a
|
||||
about
|
||||
an
|
||||
are
|
||||
as
|
||||
at
|
||||
be
|
||||
by
|
||||
com
|
||||
de
|
||||
en
|
||||
for
|
||||
from
|
||||
how
|
||||
i
|
||||
in
|
||||
is
|
||||
it
|
||||
la
|
||||
of
|
||||
on
|
||||
or
|
||||
that
|
||||
the
|
||||
this
|
||||
to
|
||||
was
|
||||
what
|
||||
when
|
||||
where
|
||||
who
|
||||
will
|
||||
with
|
||||
und
|
||||
the
|
||||
www
|
||||
CREATE TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL Tutorial','DBMS stands for DataBase ...') ,
|
||||
('How To Use MySQL Well','After you went through a ...'),
|
||||
('Optimizing MySQL','In this tutorial we will show ...'),
|
||||
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
|
||||
('MySQL vs. YourSQL','In the following database comparison ...'),
|
||||
('MySQL Security','When configured properly, MySQL ...');
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('the' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
select @@innodb_ft_server_stopword_table;
|
||||
@@innodb_ft_server_stopword_table
|
||||
NULL
|
||||
select @@innodb_ft_enable_stopword;
|
||||
@@innodb_ft_enable_stopword
|
||||
1
|
||||
select @@innodb_ft_user_stopword_table;
|
||||
@@innodb_ft_user_stopword_table
|
||||
NULL
|
||||
set global innodb_ft_server_stopword_table = "not_defined";
|
||||
ERROR 42000: Variable 'innodb_ft_server_stopword_table' can't be set to the value of 'not_defined'
|
||||
create table user_stopword(value varchar(30)) engine = innodb;
|
||||
set global innodb_ft_server_stopword_table = "test/user_stopword";
|
||||
drop index title on articles;
|
||||
create fulltext index idx on articles(title, body);
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('the' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
CREATE TABLE articles_2 (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO articles_2 (title, body)
|
||||
VALUES ('test for stopwords','this is it...');
|
||||
SELECT * FROM articles_2 WHERE MATCH (title,body)
|
||||
AGAINST ('this' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
1 test for stopwords this is it...
|
||||
insert into user_stopword values("this");
|
||||
CREATE TABLE articles_3 (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO articles_3 (title, body)
|
||||
VALUES ('test for stopwords','this is it...');
|
||||
SELECT * FROM articles_3 WHERE MATCH (title,body)
|
||||
AGAINST ('this' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
create table user_stopword_session(value varchar(30)) engine = innodb;
|
||||
insert into user_stopword_session values("session");
|
||||
set session innodb_ft_user_stopword_table="test/user_stopword_session";
|
||||
CREATE TABLE articles_4 (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO articles_4 (title, body)
|
||||
VALUES ('test for session stopwords','this should also be excluded...');
|
||||
SELECT * FROM articles_4 WHERE MATCH (title,body)
|
||||
AGAINST ('session' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
SELECT * FROM articles_4 WHERE MATCH (title,body)
|
||||
AGAINST ('this' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
1 test for session stopwords this should also be excluded...
|
||||
connect con1,localhost,root,,;
|
||||
CREATE TABLE articles_5 (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO articles_5 (title, body)
|
||||
VALUES ('test for session stopwords','this should also be excluded...');
|
||||
SELECT * FROM articles_5 WHERE MATCH (title,body)
|
||||
AGAINST ('session' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
1 test for session stopwords this should also be excluded...
|
||||
connection default;
|
||||
drop table articles;
|
||||
drop table articles_2;
|
||||
drop table articles_3;
|
||||
drop table articles_4;
|
||||
drop table articles_5;
|
||||
drop table user_stopword;
|
||||
drop table user_stopword_session;
|
||||
SET GLOBAL innodb_ft_enable_stopword=1;
|
||||
SET GLOBAL innodb_ft_server_stopword_table=default;
|
||||
CREATE TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT `idx` (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
SHOW CREATE TABLE articles;
|
||||
Table Create Table
|
||||
articles CREATE TABLE `articles` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(200) DEFAULT NULL,
|
||||
`body` text DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FULLTEXT KEY `idx` (`title`,`body`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL from Tutorial','DBMS stands for DataBase ...') ,
|
||||
('when To Use MySQL Well','After that you went through a ...'),
|
||||
('where will Optimizing MySQL','In what tutorial we will show ...'),
|
||||
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
|
||||
('MySQL vs. YourSQL','In the following database comparison ...'),
|
||||
('MySQL Security','When configured properly, MySQL ...');
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
|
||||
id title body
|
||||
INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
|
||||
id title body
|
||||
UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
|
||||
WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
|
||||
WHERE id = 7;
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
id title body
|
||||
DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE id = 7;
|
||||
id title body
|
||||
7 update the record to see will is indexed or not
|
||||
DELETE FROM articles WHERE id = 7;
|
||||
SET SESSION innodb_ft_enable_stopword = 0;
|
||||
select @@innodb_ft_enable_stopword;
|
||||
@@innodb_ft_enable_stopword
|
||||
0
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
|
||||
id title body
|
||||
INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
|
||||
id title body
|
||||
UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
|
||||
WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
|
||||
WHERE id = 8;
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
id title body
|
||||
SELECT * FROM articles WHERE id = 8;
|
||||
id title body
|
||||
8 update the record to see will is indexed or not
|
||||
DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE id = 8;
|
||||
id title body
|
||||
8 update the record to see will is indexed or not
|
||||
DELETE FROM articles WHERE id = 8;
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
SHOW CREATE TABLE articles;
|
||||
Table Create Table
|
||||
articles CREATE TABLE `articles` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(200) DEFAULT NULL,
|
||||
`body` text DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
ANALYZE TABLE articles;
|
||||
Table Op Msg_type Msg_text
|
||||
test.articles analyze status Engine-independent statistics collected
|
||||
test.articles analyze Warning Engine-independent statistics are not collected for column 'body'
|
||||
test.articles analyze status OK
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
|
||||
id title body
|
||||
2 when To Use MySQL Well After that you went through a ...
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
1 MySQL from Tutorial DBMS stands for DataBase ...
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
2 when To Use MySQL Well After that you went through a ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
|
||||
id title body
|
||||
2 when To Use MySQL Well After that you went through a ...
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
|
||||
id title body
|
||||
1 MySQL from Tutorial DBMS stands for DataBase ...
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
id title body
|
||||
9 the record will not index the , will words
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
|
||||
id title body
|
||||
9 the record will not index the , will words
|
||||
UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
|
||||
WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
SELECT COUNT(*),max(id) FROM articles;
|
||||
COUNT(*) max(id)
|
||||
7 9
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
id title body
|
||||
9 update the record to see will is indexed or not
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
9 update the record to see will is indexed or not
|
||||
DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE id = 9;
|
||||
id title body
|
||||
DROP TABLE articles;
|
||||
SET SESSION innodb_ft_enable_stopword=1;
|
||||
SET GLOBAL innodb_ft_server_stopword_table=default;
|
||||
SET SESSION innodb_ft_user_stopword_table=default;
|
||||
select @@innodb_ft_server_stopword_table;
|
||||
@@innodb_ft_server_stopword_table
|
||||
NULL
|
||||
select @@innodb_ft_enable_stopword;
|
||||
@@innodb_ft_enable_stopword
|
||||
1
|
||||
select @@innodb_ft_user_stopword_table;
|
||||
@@innodb_ft_user_stopword_table
|
||||
NULL
|
||||
CREATE TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT `idx` (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL from Tutorial','DBMS stands for DataBase ...') ,
|
||||
('when To Use MySQL Well','After that you went through a ...'),
|
||||
('where will Optimizing MySQL','In what tutorial we will show ...'),
|
||||
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
|
||||
('MySQL vs. YourSQL','In the following database comparison ...'),
|
||||
('MySQL Security','When configured properly, MySQL ...');
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
id title body
|
||||
create table user_stopword(value varchar(30)) engine = innodb;
|
||||
set session innodb_ft_user_stopword_table = "test/user_stopword";
|
||||
create table server_stopword(value varchar(30)) engine = innodb;
|
||||
set global innodb_ft_server_stopword_table = "test/server_stopword";
|
||||
insert into user_stopword values("this"),("will"),("the");
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
id title body
|
||||
insert into server_stopword values("what"),("where");
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
DELETE FROM user_stopword;
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
insert into user_stopword values("this"),("will"),("the");
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
SET SESSION innodb_ft_enable_stopword = 0;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SET SESSION innodb_ft_enable_stopword = 1;
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
id title body
|
||||
SET SESSION innodb_ft_enable_stopword = 1;
|
||||
SET SESSION innodb_ft_user_stopword_table = default;
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
DROP TABLE articles,user_stopword,server_stopword;
|
||||
SET SESSION innodb_ft_enable_stopword=1;
|
||||
SET GLOBAL innodb_ft_server_stopword_table=default;
|
||||
SET SESSION innodb_ft_user_stopword_table=default;
|
||||
select @@innodb_ft_server_stopword_table;
|
||||
@@innodb_ft_server_stopword_table
|
||||
NULL
|
||||
select @@innodb_ft_enable_stopword;
|
||||
@@innodb_ft_enable_stopword
|
||||
1
|
||||
select @@innodb_ft_user_stopword_table;
|
||||
@@innodb_ft_user_stopword_table
|
||||
NULL
|
||||
CREATE TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT `idx` (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
SHOW CREATE TABLE articles;
|
||||
Table Create Table
|
||||
articles CREATE TABLE `articles` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(200) DEFAULT NULL,
|
||||
`body` text DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FULLTEXT KEY `idx` (`title`,`body`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL from Tutorial','DBMS stands for DataBase ...') ,
|
||||
('when To Use MySQL Well','After that you went through a ...'),
|
||||
('where will Optimizing MySQL','In what tutorial we will show ...'),
|
||||
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
|
||||
('MySQL vs. YourSQL','In the following database comparison ...'),
|
||||
('MySQL Security','When configured properly, MySQL ...');
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
id title body
|
||||
create table user_stopword(value varchar(30)) engine = innodb;
|
||||
set session innodb_ft_user_stopword_table = "test/user_stopword";
|
||||
insert into user_stopword values("mysqld"),("DBMS");
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
|
||||
id title body
|
||||
1 MySQL from Tutorial DBMS stands for DataBase ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
|
||||
id title body
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
|
||||
id title body
|
||||
set session innodb_ft_user_stopword_table = default;
|
||||
create table server_stopword(value varchar(30)) engine = innodb;
|
||||
set global innodb_ft_server_stopword_table = "test/server_stopword";
|
||||
insert into server_stopword values("root"),("properly");
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
|
||||
id title body
|
||||
set session innodb_ft_user_stopword_table = "test/user_stopword";
|
||||
set global innodb_ft_server_stopword_table = "test/server_stopword";
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
|
||||
id title body
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
|
||||
id title body
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
set session innodb_ft_user_stopword_table = "test/user_stopword";
|
||||
DELETE FROM user_stopword;
|
||||
set global innodb_ft_server_stopword_table = "test/server_stopword";
|
||||
DELETE FROM server_stopword;
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
|
||||
id title body
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
|
||||
id title body
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
|
||||
id title body
|
||||
1 MySQL from Tutorial DBMS stands for DataBase ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
|
||||
id title body
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
DROP TABLE articles,user_stopword,server_stopword;
|
||||
SET SESSION innodb_ft_enable_stopword=1;
|
||||
SET GLOBAL innodb_ft_server_stopword_table=default;
|
||||
SET SESSION innodb_ft_user_stopword_table=default;
|
||||
CREATE TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT `idx` (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
SHOW CREATE TABLE articles;
|
||||
Table Create Table
|
||||
articles CREATE TABLE `articles` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(200) DEFAULT NULL,
|
||||
`body` text DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FULLTEXT KEY `idx` (`title`,`body`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL from Tutorial','DBMS stands for DataBase ...') ,
|
||||
('when To Use MySQL Well','After that you went through a ...'),
|
||||
('where will Optimizing MySQL','In what tutorial we will show ...'),
|
||||
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
|
||||
('MySQL vs. YourSQL','In the following database comparison ...'),
|
||||
('MySQL Security','When configured properly, MySQL ...');
|
||||
SET SESSION innodb_ft_enable_stopword = 0;
|
||||
select @@innodb_ft_enable_stopword;
|
||||
@@innodb_ft_enable_stopword
|
||||
0
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
connection con1;
|
||||
select @@innodb_ft_enable_stopword;
|
||||
@@innodb_ft_enable_stopword
|
||||
1
|
||||
ANALYZE TABLE articles;
|
||||
Table Op Msg_type Msg_text
|
||||
test.articles analyze status Engine-independent statistics collected
|
||||
test.articles analyze Warning Engine-independent statistics are not collected for column 'body'
|
||||
test.articles analyze status OK
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
|
||||
id title body
|
||||
2 when To Use MySQL Well After that you went through a ...
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
1 MySQL from Tutorial DBMS stands for DataBase ...
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
2 when To Use MySQL Well After that you went through a ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
|
||||
id title body
|
||||
2 when To Use MySQL Well After that you went through a ...
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
|
||||
id title body
|
||||
1 MySQL from Tutorial DBMS stands for DataBase ...
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SET SESSION innodb_ft_enable_stopword = 1;
|
||||
select @@innodb_ft_enable_stopword;
|
||||
@@innodb_ft_enable_stopword
|
||||
1
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
|
||||
id title body
|
||||
connection default;
|
||||
select @@innodb_ft_enable_stopword;
|
||||
@@innodb_ft_enable_stopword
|
||||
0
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
|
||||
id title body
|
||||
INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
|
||||
id title body
|
||||
SET SESSION innodb_ft_enable_stopword = 1;
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
|
||||
id title body
|
||||
connection con1;
|
||||
SET SESSION innodb_ft_enable_stopword = 1;
|
||||
create table user_stopword(value varchar(30)) engine = innodb;
|
||||
set session innodb_ft_user_stopword_table = "test/user_stopword";
|
||||
insert into user_stopword values("this"),("will"),("the");
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
id title body
|
||||
connection default;
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
id title body
|
||||
select @@innodb_ft_user_stopword_table;
|
||||
@@innodb_ft_user_stopword_table
|
||||
NULL
|
||||
create table user_stopword_1(value varchar(30)) engine = innodb;
|
||||
set session innodb_ft_user_stopword_table = "test/user_stopword_1";
|
||||
insert into user_stopword_1 values("when");
|
||||
SET SESSION innodb_ft_enable_stopword = 1;
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
|
||||
id title body
|
||||
2 when To Use MySQL Well After that you went through a ...
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when');
|
||||
id title body
|
||||
2 when To Use MySQL Well After that you went through a ...
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when');
|
||||
id title body
|
||||
connection con1;
|
||||
SET SESSION innodb_ft_enable_stopword = 1;
|
||||
SET SESSION innodb_ft_user_stopword_table=default;
|
||||
select @@innodb_ft_user_stopword_table;
|
||||
@@innodb_ft_user_stopword_table
|
||||
NULL
|
||||
select @@innodb_ft_server_stopword_table;
|
||||
@@innodb_ft_server_stopword_table
|
||||
NULL
|
||||
create table server_stopword(value varchar(30)) engine = innodb;
|
||||
SET GLOBAL innodb_ft_server_stopword_table = "test/server_stopword";
|
||||
select @@innodb_ft_server_stopword_table;
|
||||
@@innodb_ft_server_stopword_table
|
||||
test/server_stopword
|
||||
insert into server_stopword values("when"),("the");
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the');
|
||||
id title body
|
||||
disconnect con1;
|
||||
connection default;
|
||||
SET SESSION innodb_ft_enable_stopword = 1;
|
||||
SET SESSION innodb_ft_user_stopword_table=default;
|
||||
select @@innodb_ft_server_stopword_table;
|
||||
@@innodb_ft_server_stopword_table
|
||||
test/server_stopword
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
insert into server_stopword values("where"),("will");
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
|
||||
id title body
|
||||
3 where will Optimizing MySQL In what tutorial we will show ...
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the');
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
|
||||
id title body
|
||||
DROP TABLE articles,user_stopword,user_stopword_1,server_stopword;
|
||||
SET SESSION innodb_ft_enable_stopword=1;
|
||||
SET GLOBAL innodb_ft_server_stopword_table=default;
|
||||
SET SESSION innodb_ft_user_stopword_table=default;
|
|
@ -60,7 +60,7 @@ SET @save_dbug= @@debug_dbug;
|
|||
CREATE TABLE t1 (b CHAR(12), FULLTEXT KEY(b)) engine=InnoDB;
|
||||
SET debug_dbug='+d,ib_create_table_fail_too_many_trx';
|
||||
TRUNCATE t1;
|
||||
ERROR HY000: Got error -1 "Internal error < 0 (Not system error)" from storage engine InnoDB
|
||||
Got one of the listed errors
|
||||
SET debug_dbug=@save_dbug;
|
||||
DROP TABLE t1;
|
||||
# End of 10.3 tests
|
||||
|
|
192
mysql-test/suite/innodb_fts/r/stopword,vers.rdiff
Normal file
192
mysql-test/suite/innodb_fts/r/stopword,vers.rdiff
Normal file
|
@ -0,0 +1,192 @@
|
|||
--- stopword.result
|
||||
+++ stopword,vers.reject
|
||||
@@ -46,7 +46,7 @@
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
-) ENGINE=InnoDB;
|
||||
+) WITH SYSTEM VERSIONING ENGINE=InnoDB;
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL Tutorial','DBMS stands for DataBase ...') ,
|
||||
('How To Use MySQL Well','After you went through a ...'),
|
||||
@@ -60,7 +60,7 @@
|
||||
set global innodb_ft_server_stopword_table = "not_defined";
|
||||
ERROR 42000: Variable 'innodb_ft_server_stopword_table' can't be set to the value of 'not_defined'
|
||||
set global innodb_ft_server_stopword_table = NULL;
|
||||
-create table user_stopword(value varchar(30)) engine = innodb;
|
||||
+create table user_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb;
|
||||
set global innodb_ft_server_stopword_table = "test/user_stopword";
|
||||
drop index title on articles;
|
||||
create fulltext index idx on articles(title, body);
|
||||
@@ -73,7 +73,7 @@
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
-) ENGINE=InnoDB;
|
||||
+) WITH SYSTEM VERSIONING ENGINE=InnoDB;
|
||||
INSERT INTO articles_2 (title, body)
|
||||
VALUES ('test for stopwords','this is it...');
|
||||
SELECT * FROM articles_2 WHERE MATCH (title,body)
|
||||
@@ -88,13 +88,13 @@
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
-) ENGINE=InnoDB;
|
||||
+) WITH SYSTEM VERSIONING ENGINE=InnoDB;
|
||||
INSERT INTO articles_3 (title, body)
|
||||
VALUES ('test for stopwords','this is it...');
|
||||
SELECT * FROM articles_3 WHERE MATCH (title,body)
|
||||
AGAINST ('this' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
-create table user_stopword_session(value varchar(30)) engine = innodb;
|
||||
+create table user_stopword_session(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb;
|
||||
insert into user_stopword values("this");
|
||||
delete from user_stopword;
|
||||
insert into user_stopword_session values("session");
|
||||
@@ -104,7 +104,7 @@
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
-) ENGINE=InnoDB;
|
||||
+) WITH SYSTEM VERSIONING ENGINE=InnoDB;
|
||||
INSERT INTO articles_4 (title, body)
|
||||
VALUES ('test for session stopwords','this should also be excluded...');
|
||||
SELECT * FROM articles_4 WHERE MATCH (title,body)
|
||||
@@ -120,7 +120,7 @@
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
-) ENGINE=InnoDB;
|
||||
+) WITH SYSTEM VERSIONING ENGINE=InnoDB;
|
||||
INSERT INTO articles_5 (title, body)
|
||||
VALUES ('test for session stopwords','this should also be excluded...');
|
||||
SELECT * FROM articles_5 WHERE MATCH (title,body)
|
||||
@@ -142,7 +142,7 @@
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT `idx` (title,body)
|
||||
-) ENGINE=InnoDB;
|
||||
+) WITH SYSTEM VERSIONING ENGINE=InnoDB;
|
||||
SHOW CREATE TABLE articles;
|
||||
Table Create Table
|
||||
articles CREATE TABLE `articles` (
|
||||
@@ -151,7 +151,7 @@
|
||||
`body` text DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FULLTEXT KEY `idx` (`title`,`body`)
|
||||
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL from Tutorial','DBMS stands for DataBase ...') ,
|
||||
('when To Use MySQL Well','After that you went through a ...'),
|
||||
@@ -248,7 +248,7 @@
|
||||
`title` varchar(200) DEFAULT NULL,
|
||||
`body` text DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
-) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
+) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
ANALYZE TABLE articles;
|
||||
Table Op Msg_type Msg_text
|
||||
@@ -320,7 +320,7 @@
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT `idx` (title,body)
|
||||
-) ENGINE=InnoDB;
|
||||
+) WITH SYSTEM VERSIONING ENGINE=InnoDB;
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL from Tutorial','DBMS stands for DataBase ...') ,
|
||||
('when To Use MySQL Well','After that you went through a ...'),
|
||||
@@ -332,9 +332,9 @@
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
id title body
|
||||
-create table user_stopword(value varchar(30)) engine = innodb;
|
||||
+create table user_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb;
|
||||
set session innodb_ft_user_stopword_table = "test/user_stopword";
|
||||
-create table server_stopword(value varchar(30)) engine = innodb;
|
||||
+create table server_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb;
|
||||
set global innodb_ft_server_stopword_table = "test/server_stopword";
|
||||
insert into user_stopword values("when"),("where");
|
||||
delete from user_stopword;
|
||||
@@ -419,7 +419,7 @@
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT `idx` (title,body)
|
||||
-) ENGINE=InnoDB;
|
||||
+) WITH SYSTEM VERSIONING ENGINE=InnoDB;
|
||||
SHOW CREATE TABLE articles;
|
||||
Table Create Table
|
||||
articles CREATE TABLE `articles` (
|
||||
@@ -428,7 +428,7 @@
|
||||
`body` text DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FULLTEXT KEY `idx` (`title`,`body`)
|
||||
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL from Tutorial','DBMS stands for DataBase ...') ,
|
||||
('when To Use MySQL Well','After that you went through a ...'),
|
||||
@@ -440,7 +440,7 @@
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
id title body
|
||||
-create table user_stopword(value varchar(30)) engine = innodb;
|
||||
+create table user_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb;
|
||||
set session innodb_ft_user_stopword_table = "test/user_stopword";
|
||||
insert into user_stopword values("mysqld"),("DBMS");
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
|
||||
@@ -466,7 +466,7 @@
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
|
||||
id title body
|
||||
set session innodb_ft_user_stopword_table = default;
|
||||
-create table server_stopword(value varchar(30)) engine = innodb;
|
||||
+create table server_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb;
|
||||
set global innodb_ft_server_stopword_table = "test/server_stopword";
|
||||
insert into server_stopword values("root"),("properly");
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
@@ -530,7 +530,7 @@
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT `idx` (title,body)
|
||||
-) ENGINE=InnoDB;
|
||||
+) WITH SYSTEM VERSIONING ENGINE=InnoDB;
|
||||
SHOW CREATE TABLE articles;
|
||||
Table Create Table
|
||||
articles CREATE TABLE `articles` (
|
||||
@@ -539,7 +539,7 @@
|
||||
`body` text DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FULLTEXT KEY `idx` (`title`,`body`)
|
||||
-) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci
|
||||
+) ENGINE=InnoDB DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL from Tutorial','DBMS stands for DataBase ...') ,
|
||||
('when To Use MySQL Well','After that you went through a ...'),
|
||||
@@ -656,7 +656,7 @@
|
||||
"In connection 1"
|
||||
connection con1;
|
||||
SET SESSION innodb_ft_enable_stopword = 1;
|
||||
-create table user_stopword(value varchar(30)) engine = innodb;
|
||||
+create table user_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb;
|
||||
set session innodb_ft_user_stopword_table = "test/user_stopword";
|
||||
insert into user_stopword values("this"),("will"),("the");
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
@@ -674,7 +674,7 @@
|
||||
select @@innodb_ft_user_stopword_table;
|
||||
@@innodb_ft_user_stopword_table
|
||||
NULL
|
||||
-create table user_stopword_1(value varchar(30)) engine = innodb;
|
||||
+create table user_stopword_1(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb;
|
||||
set session innodb_ft_user_stopword_table = "test/user_stopword_1";
|
||||
insert into user_stopword_1 values("when");
|
||||
SET SESSION innodb_ft_enable_stopword = 1;
|
||||
@@ -702,7 +702,7 @@
|
||||
select @@innodb_ft_server_stopword_table;
|
||||
@@innodb_ft_server_stopword_table
|
||||
NULL
|
||||
-create table server_stopword(value varchar(30)) engine = innodb;
|
||||
+create table server_stopword(value varchar(30)) WITH SYSTEM VERSIONING engine = innodb;
|
||||
SET GLOBAL innodb_ft_server_stopword_table = "test/server_stopword";
|
||||
select @@innodb_ft_server_stopword_table;
|
||||
@@innodb_ft_server_stopword_table
|
|
@ -1,3 +1,6 @@
|
|||
SET @innodb_ft_server_stopword_table_orig=@@innodb_ft_server_stopword_table;
|
||||
SET @innodb_ft_enable_stopword_orig=@@innodb_ft_enable_stopword;
|
||||
SET @innodb_ft_user_stopword_table_orig=@@innodb_ft_user_stopword_table;
|
||||
call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table not_defined does not exist.");
|
||||
call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table test/user_stopword_session does not exist.");
|
||||
select * from information_schema.innodb_ft_default_stopword;
|
||||
|
@ -54,9 +57,6 @@ INSERT INTO articles (title,body) VALUES
|
|||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('the' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
SET @innodb_ft_server_stopword_table_orig=@@innodb_ft_server_stopword_table;
|
||||
SET @innodb_ft_enable_stopword_orig=@@innodb_ft_enable_stopword;
|
||||
SET @innodb_ft_user_stopword_table_orig=@@innodb_ft_user_stopword_table;
|
||||
set global innodb_ft_server_stopword_table = "not_defined";
|
||||
ERROR 42000: Variable 'innodb_ft_server_stopword_table' can't be set to the value of 'not_defined'
|
||||
set global innodb_ft_server_stopword_table = NULL;
|
||||
|
@ -80,6 +80,8 @@ SELECT * FROM articles_2 WHERE MATCH (title,body)
|
|||
AGAINST ('this' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
1 test for stopwords this is it...
|
||||
insert into user_stopword values("the");
|
||||
delete from user_stopword;
|
||||
insert into user_stopword values("this");
|
||||
CREATE TABLE articles_3 (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
|
@ -93,6 +95,8 @@ SELECT * FROM articles_3 WHERE MATCH (title,body)
|
|||
AGAINST ('this' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
create table user_stopword_session(value varchar(30)) engine = innodb;
|
||||
insert into user_stopword values("this");
|
||||
delete from user_stopword;
|
||||
insert into user_stopword_session values("session");
|
||||
set session innodb_ft_user_stopword_table="test/user_stopword_session";
|
||||
CREATE TABLE articles_4 (
|
||||
|
@ -334,6 +338,8 @@ create table user_stopword(value varchar(30)) engine = innodb;
|
|||
set session innodb_ft_user_stopword_table = "test/user_stopword";
|
||||
create table server_stopword(value varchar(30)) engine = innodb;
|
||||
set global innodb_ft_server_stopword_table = "test/server_stopword";
|
||||
insert into user_stopword values("when"),("where");
|
||||
delete from user_stopword;
|
||||
insert into user_stopword values("this"),("will"),("the");
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
|
|
695
mysql-test/suite/innodb_fts/r/versioning,prepare.result
Normal file
695
mysql-test/suite/innodb_fts/r/versioning,prepare.result
Normal file
|
@ -0,0 +1,695 @@
|
|||
# Upgrade test
|
||||
CREATE TEMPORARY TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
ERROR HY000: Cannot create FULLTEXT index on temporary InnoDB table
|
||||
CREATE TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
)with system versioning ENGINE=InnoDB;
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL Tutorial','DBMS stands for DataBase ...') ,
|
||||
('How To Use MySQL Well','After you went through a ...'),
|
||||
('Optimizing MySQL','In this tutorial we will show ...'),
|
||||
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
|
||||
('MySQL vs. YourSQL','In the following database comparison ...'),
|
||||
('MySQL Security','When configured properly, MySQL ...');
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('test query expansion','for database ...');
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('test proximity search, test, proximity and phrase',
|
||||
'search, with proximity innodb');
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('test my proximity fts new search, test, proximity and phrase',
|
||||
'search, with proximity innodb');
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('test more of proximity fts search, test, more proximity and phrase',
|
||||
'search, with proximity innodb');
|
||||
call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table not_defined does not exist.");
|
||||
call mtr.add_suppression("\\[ERROR\\] InnoDB: user stopword table test/user_stopword_session does not exist.");
|
||||
select * from information_schema.innodb_ft_default_stopword;
|
||||
value
|
||||
a
|
||||
about
|
||||
an
|
||||
are
|
||||
as
|
||||
at
|
||||
be
|
||||
by
|
||||
com
|
||||
de
|
||||
en
|
||||
for
|
||||
from
|
||||
how
|
||||
i
|
||||
in
|
||||
is
|
||||
it
|
||||
la
|
||||
of
|
||||
on
|
||||
or
|
||||
that
|
||||
the
|
||||
this
|
||||
to
|
||||
was
|
||||
what
|
||||
when
|
||||
where
|
||||
who
|
||||
will
|
||||
with
|
||||
und
|
||||
the
|
||||
www
|
||||
CREATE TABLE articles2 (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
)with system versioning ENGINE=InnoDB;
|
||||
INSERT INTO articles2 (title,body) VALUES
|
||||
('MySQL Tutorial','DBMS stands for DataBase ...') ,
|
||||
('How To Use MySQL Well','After you went through a ...'),
|
||||
('Optimizing MySQL','In this tutorial we will show ...'),
|
||||
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
|
||||
('MySQL vs. YourSQL','In the following database comparison ...'),
|
||||
('MySQL Security','When configured properly, MySQL ...');
|
||||
SELECT * FROM articles2 WHERE MATCH (title,body)
|
||||
AGAINST ('the' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
set global innodb_ft_server_stopword_table = "not_defined";
|
||||
ERROR 42000: Variable 'innodb_ft_server_stopword_table' can't be set to the value of 'not_defined'
|
||||
set global innodb_ft_server_stopword_table = NULL;
|
||||
create table user_stopword(value varchar(30)) engine = innodb;
|
||||
set global innodb_ft_server_stopword_table = "test/user_stopword";
|
||||
drop index title on articles2;
|
||||
create fulltext index idx on articles2(title, body);
|
||||
insert into articles2 (title, body)
|
||||
values ('test for stopwords','this is it...');
|
||||
insert into user_stopword values("the");
|
||||
delete from user_stopword;
|
||||
insert into user_stopword values("this");
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('Database' IN NATURAL LANGUAGE MODE);
|
||||
ERROR HY000: Index articles is corrupted
|
||||
call mtr.add_suppression("test/articles.? contains 3 indexes inside InnoDB");
|
||||
alter table articles force;
|
||||
Warnings:
|
||||
Warning 1082 InnoDB: Table test/articles contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB
|
||||
flush tables;
|
||||
show create table articles;
|
||||
Table Create Table
|
||||
articles CREATE TABLE `articles` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(200) DEFAULT NULL,
|
||||
`body` text DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FULLTEXT KEY `title` (`title`,`body`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('Database' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
7 test query expansion for database ...
|
||||
SELECT COUNT(*) FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('database' IN NATURAL LANGUAGE MODE);
|
||||
COUNT(*)
|
||||
3
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title, body)
|
||||
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
SELECT COUNT(IF(MATCH (title,body)
|
||||
AGAINST ('database' IN NATURAL LANGUAGE MODE), 1, NULL))
|
||||
AS count FROM articles;
|
||||
count
|
||||
3
|
||||
SELECT id, body, MATCH (title,body)
|
||||
AGAINST ('Database' IN NATURAL LANGUAGE MODE) AS score
|
||||
FROM articles;
|
||||
id body score
|
||||
1 DBMS stands for DataBase ... 0.2734021842479706
|
||||
2 After you went through a ... 0
|
||||
3 In this tutorial we will show ... 0
|
||||
4 1. Never run mysqld as root. 2. ... 0
|
||||
5 In the following database comparison ... 0.2734021842479706
|
||||
6 When configured properly, MySQL ... 0
|
||||
7 for database ... 0.2734021842479706
|
||||
8 search, with proximity innodb 0
|
||||
9 search, with proximity innodb 0
|
||||
10 search, with proximity innodb 0
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('MySQL' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
|
||||
id title body
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('DBMS Security' IN BOOLEAN MODE);
|
||||
id title body
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+MySQL YourSQL' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+MySQL ~YourSQL' IN BOOLEAN MODE);
|
||||
id title body
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('t*' IN BOOLEAN MODE);
|
||||
id title body
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
7 test query expansion for database ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('MY*' IN BOOLEAN MODE);
|
||||
id title body
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('ru*' IN BOOLEAN MODE);
|
||||
id title body
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+ MySQL >Well < stands' IN BOOLEAN MODE);
|
||||
id title body
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+ MySQL - (Well stands)' IN BOOLEAN MODE);
|
||||
id title body
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
ERROR HY000: Table handler out of memory
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
id title body
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))'
|
||||
IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
ERROR 42000: syntax error, unexpected $end
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
ERROR 42000: syntax error, unexpected $end
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+ MySQL + (>Well < stands)' IN BOOLEAN MODE);
|
||||
id title body
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('YourSQL + (+MySQL - (Tricks Security))' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('(+MySQL - (Tricks Security)) - YourSQL' IN BOOLEAN MODE);
|
||||
id title body
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - Security&DBMS' IN BOOLEAN MODE);
|
||||
id title body
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - (Security DBMS)' IN BOOLEAN MODE);
|
||||
id title body
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST (' - Security&DBMS + YourSQL' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL - Security&DBMS' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT COUNT(*) FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('database' WITH QUERY EXPANSION);
|
||||
COUNT(*)
|
||||
10
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('test' WITH QUERY EXPANSION);
|
||||
id title body
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
7 test query expansion for database ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"following comparison"@3' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"following comparison"@2' IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"following database"' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"proximity search"@3' IN BOOLEAN MODE);
|
||||
id title body
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"proximity search"@2' IN BOOLEAN MODE);
|
||||
id title body
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"proximity search"@5' IN BOOLEAN MODE);
|
||||
id title body
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"test proximity"@5' IN BOOLEAN MODE);
|
||||
id title body
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"test proximity"@1' IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"test proximity"@4' IN BOOLEAN MODE);
|
||||
id title body
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"test proximity"@3' IN BOOLEAN MODE);
|
||||
id title body
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"more test proximity"@4' IN BOOLEAN MODE);
|
||||
id title body
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"more test proximity"@3' IN BOOLEAN MODE);
|
||||
id title body
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"more test proximity"' IN BOOLEAN MODE);
|
||||
id title body
|
||||
set global innodb_ft_server_stopword_table= "test/user_stopword";
|
||||
SELECT * FROM articles2 WHERE MATCH (title,body)
|
||||
AGAINST ('the' IN NATURAL LANGUAGE MODE);
|
||||
SELECT * FROM articles2 WHERE MATCH (title,body)
|
||||
AGAINST ('this' IN NATURAL LANGUAGE MODE);
|
||||
drop index idx on articles2;
|
||||
Warnings:
|
||||
Warning 1082 InnoDB: Table test/articles2 contains 3 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB
|
||||
create fulltext index idx on articles2(title, body);
|
||||
SELECT * FROM articles2 WHERE MATCH (title,body)
|
||||
AGAINST ('the' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles2 WHERE MATCH (title,body)
|
||||
AGAINST ('this' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
# Downgrade test
|
||||
alter table articles force;
|
||||
Warnings:
|
||||
Warning 1082 InnoDB: Table test/articles contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB
|
||||
Warning 1082 InnoDB: Table test/articles contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB
|
||||
flush tables;
|
||||
show create table articles;
|
||||
Table Create Table
|
||||
articles CREATE TABLE `articles` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(200) DEFAULT NULL,
|
||||
`body` text DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FULLTEXT KEY `title` (`title`,`body`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('Database' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
7 test query expansion for database ...
|
||||
SELECT COUNT(*) FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('database' IN NATURAL LANGUAGE MODE);
|
||||
COUNT(*)
|
||||
3
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title, body)
|
||||
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
SELECT COUNT(IF(MATCH (title,body)
|
||||
AGAINST ('database' IN NATURAL LANGUAGE MODE), 1, NULL))
|
||||
AS count FROM articles;
|
||||
count
|
||||
3
|
||||
SELECT id, body, MATCH (title,body)
|
||||
AGAINST ('Database' IN NATURAL LANGUAGE MODE) AS score
|
||||
FROM articles;
|
||||
id body score
|
||||
1 DBMS stands for DataBase ... 0.2734021842479706
|
||||
2 After you went through a ... 0
|
||||
3 In this tutorial we will show ... 0
|
||||
4 1. Never run mysqld as root. 2. ... 0
|
||||
5 In the following database comparison ... 0.2734021842479706
|
||||
6 When configured properly, MySQL ... 0
|
||||
7 for database ... 0.2734021842479706
|
||||
8 search, with proximity innodb 0
|
||||
9 search, with proximity innodb 0
|
||||
10 search, with proximity innodb 0
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('MySQL' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
|
||||
id title body
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('DBMS Security' IN BOOLEAN MODE);
|
||||
id title body
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+MySQL YourSQL' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+MySQL ~YourSQL' IN BOOLEAN MODE);
|
||||
id title body
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('t*' IN BOOLEAN MODE);
|
||||
id title body
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
7 test query expansion for database ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('MY*' IN BOOLEAN MODE);
|
||||
id title body
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('ru*' IN BOOLEAN MODE);
|
||||
id title body
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+ MySQL >Well < stands' IN BOOLEAN MODE);
|
||||
id title body
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+ MySQL - (Well stands)' IN BOOLEAN MODE);
|
||||
id title body
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
ERROR HY000: Table handler out of memory
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
id title body
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))'
|
||||
IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
ERROR 42000: syntax error, unexpected $end
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
ERROR 42000: syntax error, unexpected $end
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+ MySQL + (>Well < stands)' IN BOOLEAN MODE);
|
||||
id title body
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('YourSQL + (+MySQL - (Tricks Security))' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('(+MySQL - (Tricks Security)) - YourSQL' IN BOOLEAN MODE);
|
||||
id title body
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - Security&DBMS' IN BOOLEAN MODE);
|
||||
id title body
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - (Security DBMS)' IN BOOLEAN MODE);
|
||||
id title body
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST (' - Security&DBMS + YourSQL' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL - Security&DBMS' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT COUNT(*) FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('database' WITH QUERY EXPANSION);
|
||||
COUNT(*)
|
||||
10
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('test' WITH QUERY EXPANSION);
|
||||
id title body
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
7 test query expansion for database ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"following comparison"@3' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"following comparison"@2' IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"following database"' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"proximity search"@3' IN BOOLEAN MODE);
|
||||
id title body
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"proximity search"@2' IN BOOLEAN MODE);
|
||||
id title body
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"proximity search"@5' IN BOOLEAN MODE);
|
||||
id title body
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"test proximity"@5' IN BOOLEAN MODE);
|
||||
id title body
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"test proximity"@1' IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"test proximity"@4' IN BOOLEAN MODE);
|
||||
id title body
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"test proximity"@3' IN BOOLEAN MODE);
|
||||
id title body
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"more test proximity"@4' IN BOOLEAN MODE);
|
||||
id title body
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"more test proximity"@3' IN BOOLEAN MODE);
|
||||
id title body
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"more test proximity"' IN BOOLEAN MODE);
|
||||
id title body
|
||||
set global innodb_ft_server_stopword_table= "test/user_stopword";
|
||||
drop index idx on articles2;
|
||||
Warnings:
|
||||
Warning 1082 InnoDB: Table test/articles2 contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB
|
||||
Warning 1082 InnoDB: Table test/articles2 contains 3 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB
|
||||
create fulltext index idx on articles2(title, body);
|
||||
SELECT * FROM articles2 WHERE MATCH (title,body)
|
||||
AGAINST ('the' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
SELECT * FROM articles2 WHERE MATCH (title,body)
|
||||
AGAINST ('this' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
# Cleanup
|
||||
drop tables articles, articles2, user_stopword;
|
||||
set global innodb_ft_server_stopword_table= default;
|
303
mysql-test/suite/innodb_fts/r/versioning.result
Normal file
303
mysql-test/suite/innodb_fts/r/versioning.result
Normal file
|
@ -0,0 +1,303 @@
|
|||
# Upgrade test
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('Database' IN NATURAL LANGUAGE MODE);
|
||||
ERROR HY000: Index articles is corrupted
|
||||
call mtr.add_suppression("test/articles.? contains 3 indexes inside InnoDB");
|
||||
alter table articles force;
|
||||
Warnings:
|
||||
Warning 1082 InnoDB: Table test/articles contains 3 indexes inside InnoDB, which is different from the number of indexes 2 defined in the MariaDB
|
||||
flush tables;
|
||||
show create table articles;
|
||||
Table Create Table
|
||||
articles CREATE TABLE `articles` (
|
||||
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
|
||||
`title` varchar(200) DEFAULT NULL,
|
||||
`body` text DEFAULT NULL,
|
||||
PRIMARY KEY (`id`),
|
||||
FULLTEXT KEY `title` (`title`,`body`)
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=11 DEFAULT CHARSET=latin1 COLLATE=latin1_swedish_ci WITH SYSTEM VERSIONING
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('Database' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
7 test query expansion for database ...
|
||||
SELECT COUNT(*) FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('database' IN NATURAL LANGUAGE MODE);
|
||||
COUNT(*)
|
||||
3
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title, body)
|
||||
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
SELECT COUNT(IF(MATCH (title,body)
|
||||
AGAINST ('database' IN NATURAL LANGUAGE MODE), 1, NULL))
|
||||
AS count FROM articles;
|
||||
count
|
||||
3
|
||||
SELECT id, body, MATCH (title,body)
|
||||
AGAINST ('Database' IN NATURAL LANGUAGE MODE) AS score
|
||||
FROM articles;
|
||||
id body score
|
||||
1 DBMS stands for DataBase ... 0.2734021842479706
|
||||
2 After you went through a ... 0
|
||||
3 In this tutorial we will show ... 0
|
||||
4 1. Never run mysqld as root. 2. ... 0
|
||||
5 In the following database comparison ... 0.2734021842479706
|
||||
6 When configured properly, MySQL ... 0
|
||||
7 for database ... 0.2734021842479706
|
||||
8 search, with proximity innodb 0
|
||||
9 search, with proximity innodb 0
|
||||
10 search, with proximity innodb 0
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('MySQL' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
|
||||
id title body
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('DBMS Security' IN BOOLEAN MODE);
|
||||
id title body
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+MySQL YourSQL' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+MySQL ~YourSQL' IN BOOLEAN MODE);
|
||||
id title body
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('t*' IN BOOLEAN MODE);
|
||||
id title body
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
7 test query expansion for database ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('MY*' IN BOOLEAN MODE);
|
||||
id title body
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('ru*' IN BOOLEAN MODE);
|
||||
id title body
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+ MySQL >Well < stands' IN BOOLEAN MODE);
|
||||
id title body
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+ MySQL - (Well stands)' IN BOOLEAN MODE);
|
||||
id title body
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
ERROR HY000: Table handler out of memory
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
id title body
|
||||
6 MySQL Security When configured properly, MySQL ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))'
|
||||
IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
ERROR 42000: syntax error, unexpected $end
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
ERROR 42000: syntax error, unexpected $end
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+ MySQL + (>Well < stands)' IN BOOLEAN MODE);
|
||||
id title body
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('YourSQL + (+MySQL - (Tricks Security))' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('(+MySQL - (Tricks Security)) - YourSQL' IN BOOLEAN MODE);
|
||||
id title body
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - Security&DBMS' IN BOOLEAN MODE);
|
||||
id title body
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - (Security DBMS)' IN BOOLEAN MODE);
|
||||
id title body
|
||||
2 How To Use MySQL Well After you went through a ...
|
||||
3 Optimizing MySQL In this tutorial we will show ...
|
||||
4 1001 MySQL Tricks 1. Never run mysqld as root. 2. ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST (' - Security&DBMS + YourSQL' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL - Security&DBMS' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT COUNT(*) FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('database' WITH QUERY EXPANSION);
|
||||
COUNT(*)
|
||||
10
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('test' WITH QUERY EXPANSION);
|
||||
id title body
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
7 test query expansion for database ...
|
||||
1 MySQL Tutorial DBMS stands for DataBase ...
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"following comparison"@3' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"following comparison"@2' IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"following database"' IN BOOLEAN MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"proximity search"@3' IN BOOLEAN MODE);
|
||||
id title body
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"proximity search"@2' IN BOOLEAN MODE);
|
||||
id title body
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"proximity search"@5' IN BOOLEAN MODE);
|
||||
id title body
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"test proximity"@5' IN BOOLEAN MODE);
|
||||
id title body
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"test proximity"@1' IN BOOLEAN MODE);
|
||||
id title body
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"test proximity"@4' IN BOOLEAN MODE);
|
||||
id title body
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"test proximity"@3' IN BOOLEAN MODE);
|
||||
id title body
|
||||
8 test proximity search, test, proximity and phrase search, with proximity innodb
|
||||
9 test my proximity fts new search, test, proximity and phrase search, with proximity innodb
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"more test proximity"@4' IN BOOLEAN MODE);
|
||||
id title body
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"more test proximity"@3' IN BOOLEAN MODE);
|
||||
id title body
|
||||
10 test more of proximity fts search, test, more proximity and phrase search, with proximity innodb
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"more test proximity"' IN BOOLEAN MODE);
|
||||
id title body
|
||||
set global innodb_ft_server_stopword_table= "test/user_stopword";
|
||||
SELECT * FROM articles2 WHERE MATCH (title,body)
|
||||
AGAINST ('the' IN NATURAL LANGUAGE MODE);
|
||||
SELECT * FROM articles2 WHERE MATCH (title,body)
|
||||
AGAINST ('this' IN NATURAL LANGUAGE MODE);
|
||||
drop index idx on articles2;
|
||||
Warnings:
|
||||
Warning 1082 InnoDB: Table test/articles2 contains 3 indexes inside InnoDB, which is different from the number of indexes 1 defined in the MariaDB
|
||||
create fulltext index idx on articles2(title, body);
|
||||
SELECT * FROM articles2 WHERE MATCH (title,body)
|
||||
AGAINST ('the' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
5 MySQL vs. YourSQL In the following database comparison ...
|
||||
SELECT * FROM articles2 WHERE MATCH (title,body)
|
||||
AGAINST ('this' IN NATURAL LANGUAGE MODE);
|
||||
id title body
|
||||
# Cleanup
|
||||
drop tables articles, articles2, user_stopword;
|
||||
set global innodb_ft_server_stopword_table= default;
|
264
mysql-test/suite/innodb_fts/t/basic.inc
Normal file
264
mysql-test/suite/innodb_fts/t/basic.inc
Normal file
|
@ -0,0 +1,264 @@
|
|||
if ($basic_stage == create_table)
|
||||
{
|
||||
# Create FTS table
|
||||
--error ER_INNODB_NO_FT_TEMP_TABLE
|
||||
CREATE TEMPORARY TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
--disable_query_log
|
||||
eval CREATE TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
)$create_options ENGINE=InnoDB;
|
||||
--enable_query_log
|
||||
}
|
||||
|
||||
if ($basic_stage == insert_1)
|
||||
{
|
||||
# Insert six rows
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL Tutorial','DBMS stands for DataBase ...') ,
|
||||
('How To Use MySQL Well','After you went through a ...'),
|
||||
('Optimizing MySQL','In this tutorial we will show ...'),
|
||||
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
|
||||
('MySQL vs. YourSQL','In the following database comparison ...'),
|
||||
('MySQL Security','When configured properly, MySQL ...');
|
||||
}
|
||||
|
||||
if ($basic_stage == select_1)
|
||||
{
|
||||
# Look for 'Database' in table article
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('Database' IN NATURAL LANGUAGE MODE);
|
||||
|
||||
SELECT COUNT(*) FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('database' IN NATURAL LANGUAGE MODE);
|
||||
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title, body)
|
||||
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
|
||||
|
||||
|
||||
SELECT COUNT(IF(MATCH (title,body)
|
||||
AGAINST ('database' IN NATURAL LANGUAGE MODE), 1, NULL))
|
||||
AS count FROM articles;
|
||||
|
||||
# Select Relevance Ranking
|
||||
SELECT id, body, MATCH (title,body)
|
||||
AGAINST ('Database' IN NATURAL LANGUAGE MODE) AS score
|
||||
FROM articles;
|
||||
|
||||
# 'MySQL' treated as stopword (stopword functionality not yet supported)
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('MySQL' IN NATURAL LANGUAGE MODE);
|
||||
|
||||
# Boolean search
|
||||
# Select rows contain "MySQL" but not "YourSQL"
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
|
||||
|
||||
# Select rows contain at least one of the two words
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('DBMS Security' IN BOOLEAN MODE);
|
||||
|
||||
# Select rows contain both "MySQL" and "YourSQL"
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE);
|
||||
|
||||
# Select rows contain "MySQL" but rank rows with "YourSQL" higher
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+MySQL YourSQL' IN BOOLEAN MODE);
|
||||
|
||||
# Test negation operator. Select rows contain MySQL,
|
||||
# if the row contains "YourSQL", rank it lower
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+MySQL ~YourSQL' IN BOOLEAN MODE);
|
||||
|
||||
# Test wild card search operator
|
||||
# Notice row with "the" will not get fetched due to
|
||||
# stopword filtering
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('t*' IN BOOLEAN MODE);
|
||||
|
||||
# Test wild card search, notice row 6 with 2 "MySQL" rank first
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('MY*' IN BOOLEAN MODE);
|
||||
|
||||
# Another wild card search
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('ru*' IN BOOLEAN MODE);
|
||||
|
||||
# Test ">" and "<" Operator, the ">" operator increases
|
||||
# the word relevance rank and the "<" operator decreases it
|
||||
# Following test puts rows with "Well" on top and rows
|
||||
# with "stands" at the bottom
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+ MySQL >Well < stands' IN BOOLEAN MODE);
|
||||
|
||||
# Test sub-expression boolean search. Find rows contain
|
||||
# "MySQL" but not "Well" or "stands".
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+ MySQL - (Well stands)' IN BOOLEAN MODE);
|
||||
|
||||
--error 128
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))'
|
||||
IN BOOLEAN MODE);
|
||||
|
||||
--error ER_PARSE_ERROR
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
--error ER_PARSE_ERROR
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
|
||||
# Test sub-expression boolean search. Find rows contain
|
||||
# "MySQL" and "Well" or "MySQL" and "stands". But rank the
|
||||
# doc with "Well" higher, and doc with "stands" lower.
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+ MySQL + (>Well < stands)' IN BOOLEAN MODE);
|
||||
|
||||
# Test nested sub-expression.
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('YourSQL + (+MySQL - (Tricks Security))' IN BOOLEAN MODE);
|
||||
|
||||
# Find rows with "MySQL" but not "Tricks", "Security" nor "YourSQL"
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('(+MySQL - (Tricks Security)) - YourSQL' IN BOOLEAN MODE);
|
||||
|
||||
# Test non-word delimiter combined with negate "-" operator
|
||||
# This should return the same result as 'mysql - (Security DBMS)'
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - Security&DBMS' IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - (Security DBMS)' IN BOOLEAN MODE);
|
||||
|
||||
# Again, the operator sequence should not matter
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST (' - Security&DBMS + YourSQL' IN BOOLEAN MODE);
|
||||
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL - Security&DBMS' IN BOOLEAN MODE);
|
||||
|
||||
# Test query expansion
|
||||
SELECT COUNT(*) FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('database' WITH QUERY EXPANSION);
|
||||
}
|
||||
|
||||
if ($basic_stage == insert_2)
|
||||
{
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('test query expansion','for database ...');
|
||||
}
|
||||
|
||||
if ($basic_stage == select_2)
|
||||
{
|
||||
# This query will return result containing word "database" as
|
||||
# the query expand from "test" to words in document just
|
||||
# inserted above
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('test' WITH QUERY EXPANSION);
|
||||
|
||||
# This is to test the proximity search, search two word
|
||||
# "following" and "comparison" within 19 character space
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"following comparison"@3' IN BOOLEAN MODE);
|
||||
|
||||
# This is to test the proximity search, search two word
|
||||
# "following" and "comparison" within 19 character space
|
||||
# This search should come with no return result
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"following comparison"@2' IN BOOLEAN MODE);
|
||||
|
||||
# This is to test the phrase search, searching phrase
|
||||
# "following database"
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"following database"' IN BOOLEAN MODE);
|
||||
}
|
||||
|
||||
if ($basic_stage == insert_3)
|
||||
{
|
||||
# Insert into table with similar word of different distances
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('test proximity search, test, proximity and phrase',
|
||||
'search, with proximity innodb');
|
||||
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('test my proximity fts new search, test, proximity and phrase',
|
||||
'search, with proximity innodb');
|
||||
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('test more of proximity fts search, test, more proximity and phrase',
|
||||
'search, with proximity innodb');
|
||||
}
|
||||
|
||||
if ($basic_stage == select_3)
|
||||
{
|
||||
# This should only return the first document
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"proximity search"@3' IN BOOLEAN MODE);
|
||||
|
||||
# This would return no document
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"proximity search"@2' IN BOOLEAN MODE);
|
||||
|
||||
# This give you all three documents
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"proximity search"@5' IN BOOLEAN MODE);
|
||||
|
||||
# Similar boundary testing for the words
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"test proximity"@5' IN BOOLEAN MODE);
|
||||
|
||||
# No document will be returned
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"test proximity"@1' IN BOOLEAN MODE);
|
||||
|
||||
# All three documents will be returned
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"test proximity"@4' IN BOOLEAN MODE);
|
||||
|
||||
# Only two document will be returned.
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"test proximity"@3' IN BOOLEAN MODE);
|
||||
|
||||
# Test with more word The last document will return, please notice there
|
||||
# is no ordering requirement for proximity search.
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"more test proximity"@4' IN BOOLEAN MODE);
|
||||
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"more test proximity"@3' IN BOOLEAN MODE);
|
||||
|
||||
# The phrase search will not require exact word ordering
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"more test proximity"' IN BOOLEAN MODE);
|
||||
}
|
|
@ -1,252 +1,33 @@
|
|||
# This is the basic function tests for innodb FTS
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
--let $modify_create_table= 1
|
||||
-- source include/maybe_versioning.inc
|
||||
|
||||
# Create FTS table
|
||||
--error ER_INNODB_NO_FT_TEMP_TABLE
|
||||
CREATE TEMPORARY TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
let $basic_stage= create_table;
|
||||
--source basic.inc
|
||||
|
||||
CREATE TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
# Insert six rows
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL Tutorial','DBMS stands for DataBase ...') ,
|
||||
('How To Use MySQL Well','After you went through a ...'),
|
||||
('Optimizing MySQL','In this tutorial we will show ...'),
|
||||
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
|
||||
('MySQL vs. YourSQL','In the following database comparison ...'),
|
||||
('MySQL Security','When configured properly, MySQL ...');
|
||||
let $basic_stage= insert_1;
|
||||
--source basic.inc
|
||||
|
||||
-- disable_result_log
|
||||
ANALYZE TABLE articles;
|
||||
-- enable_result_log
|
||||
|
||||
# Look for 'Database' in table article
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('Database' IN NATURAL LANGUAGE MODE);
|
||||
let $basic_stage= select_1;
|
||||
--source basic.inc
|
||||
|
||||
SELECT COUNT(*) FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('database' IN NATURAL LANGUAGE MODE);
|
||||
let $basic_stage= insert_2;
|
||||
--source basic.inc
|
||||
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title, body)
|
||||
AGAINST ('Tutorial' IN NATURAL LANGUAGE MODE);
|
||||
let $basic_stage= select_2;
|
||||
--source basic.inc
|
||||
|
||||
let $basic_stage= insert_3;
|
||||
--source basic.inc
|
||||
|
||||
SELECT COUNT(IF(MATCH (title,body)
|
||||
AGAINST ('database' IN NATURAL LANGUAGE MODE), 1, NULL))
|
||||
AS count FROM articles;
|
||||
|
||||
# Select Relevance Ranking
|
||||
SELECT id, body, MATCH (title,body)
|
||||
AGAINST ('Database' IN NATURAL LANGUAGE MODE) AS score
|
||||
FROM articles;
|
||||
|
||||
# 'MySQL' treated as stopword (stopword functionality not yet supported)
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('MySQL' IN NATURAL LANGUAGE MODE);
|
||||
|
||||
# Boolean search
|
||||
# Select rows contain "MySQL" but not "YourSQL"
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
|
||||
|
||||
# Select rows contain at least one of the two words
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('DBMS Security' IN BOOLEAN MODE);
|
||||
|
||||
# Select rows contain both "MySQL" and "YourSQL"
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+MySQL +YourSQL' IN BOOLEAN MODE);
|
||||
|
||||
# Select rows contain "MySQL" but rank rows with "YourSQL" higher
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+MySQL YourSQL' IN BOOLEAN MODE);
|
||||
|
||||
# Test negation operator. Select rows contain MySQL,
|
||||
# if the row contains "YourSQL", rank it lower
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+MySQL ~YourSQL' IN BOOLEAN MODE);
|
||||
|
||||
# Test wild card search operator
|
||||
# Notice row with "the" will not get fetched due to
|
||||
# stopword filtering
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('t*' IN BOOLEAN MODE);
|
||||
|
||||
# Test wild card search, notice row 6 with 2 "MySQL" rank first
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('MY*' IN BOOLEAN MODE);
|
||||
|
||||
# Another wild card search
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('ru*' IN BOOLEAN MODE);
|
||||
|
||||
# Test ">" and "<" Operator, the ">" operator increases
|
||||
# the word relevance rank and the "<" operator decreases it
|
||||
# Following test puts rows with "Well" on top and rows
|
||||
# with "stands" at the bottom
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+ MySQL >Well < stands' IN BOOLEAN MODE);
|
||||
|
||||
# Test sub-expression boolean search. Find rows contain
|
||||
# "MySQL" but not "Well" or "stands".
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+ MySQL - (Well stands)' IN BOOLEAN MODE);
|
||||
|
||||
--error 128
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((vs))))))))))))))))))))))))))))))),(((to)))'
|
||||
IN BOOLEAN MODE);
|
||||
|
||||
--error ER_PARSE_ERROR
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('((((((((((((((((((((((((((((((((Security)))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
--error ER_PARSE_ERROR
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST
|
||||
('(((((((((((((((((((((((((((((((((Security))))))))))))))))))))))))))))))))'
|
||||
IN BOOLEAN MODE);
|
||||
|
||||
# Test sub-expression boolean search. Find rows contain
|
||||
# "MySQL" and "Well" or "MySQL" and "stands". But rank the
|
||||
# doc with "Well" higher, and doc with "stands" lower.
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('+ MySQL + (>Well < stands)' IN BOOLEAN MODE);
|
||||
|
||||
# Test nested sub-expression.
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('YourSQL + (+MySQL - (Tricks Security))' IN BOOLEAN MODE);
|
||||
|
||||
# Find rows with "MySQL" but not "Tricks", "Security" nor "YourSQL"
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('(+MySQL - (Tricks Security)) - YourSQL' IN BOOLEAN MODE);
|
||||
|
||||
# Test non-word delimiter combined with negate "-" operator
|
||||
# This should return the same result as 'mysql - (Security DBMS)'
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - Security&DBMS' IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysql - (Security DBMS)' IN BOOLEAN MODE);
|
||||
|
||||
# Again, the operator sequence should not matter
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST (' - Security&DBMS + YourSQL' IN BOOLEAN MODE);
|
||||
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('+YourSQL - Security&DBMS' IN BOOLEAN MODE);
|
||||
|
||||
# Test query expansion
|
||||
SELECT COUNT(*) FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('database' WITH QUERY EXPANSION);
|
||||
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('test query expansion','for database ...');
|
||||
|
||||
# This query will return result containing word "database" as
|
||||
# the query expand from "test" to words in document just
|
||||
# inserted above
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('test' WITH QUERY EXPANSION);
|
||||
|
||||
# This is to test the proximity search, search two word
|
||||
# "following" and "comparison" within 19 character space
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"following comparison"@3' IN BOOLEAN MODE);
|
||||
|
||||
# This is to test the proximity search, search two word
|
||||
# "following" and "comparison" within 19 character space
|
||||
# This search should come with no return result
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"following comparison"@2' IN BOOLEAN MODE);
|
||||
|
||||
# This is to test the phrase search, searching phrase
|
||||
# "following database"
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"following database"' IN BOOLEAN MODE);
|
||||
|
||||
# Insert into table with similar word of different distances
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('test proximity search, test, proximity and phrase',
|
||||
'search, with proximity innodb');
|
||||
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('test my proximity fts new search, test, proximity and phrase',
|
||||
'search, with proximity innodb');
|
||||
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('test more of proximity fts search, test, more proximity and phrase',
|
||||
'search, with proximity innodb');
|
||||
|
||||
# This should only return the first document
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"proximity search"@3' IN BOOLEAN MODE);
|
||||
|
||||
# This would return no document
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"proximity search"@2' IN BOOLEAN MODE);
|
||||
|
||||
# This give you all three documents
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"proximity search"@5' IN BOOLEAN MODE);
|
||||
|
||||
# Similar boundary testing for the words
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"test proximity"@5' IN BOOLEAN MODE);
|
||||
|
||||
# No document will be returned
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"test proximity"@1' IN BOOLEAN MODE);
|
||||
|
||||
# All three documents will be returned
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"test proximity"@4' IN BOOLEAN MODE);
|
||||
|
||||
# Only two document will be returned.
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"test proximity"@3' IN BOOLEAN MODE);
|
||||
|
||||
# Test with more word The last document will return, please notice there
|
||||
# is no ordering requirement for proximity search.
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"more test proximity"@4' IN BOOLEAN MODE);
|
||||
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"more test proximity"@3' IN BOOLEAN MODE);
|
||||
|
||||
# The phrase search will not require exact word ordering
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
AGAINST ('"more test proximity"' IN BOOLEAN MODE);
|
||||
let $basic_stage= select_3;
|
||||
--source basic.inc
|
||||
|
||||
drop table articles;
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
# The embedded server tests do not support restarting.
|
||||
--source include/not_embedded.inc
|
||||
--source include/maybe_debug.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
FLUSH TABLES;
|
||||
# Following are test for crash recovery on FTS index, the first scenario
|
||||
|
@ -22,6 +23,16 @@ CREATE TABLE articles (
|
|||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
let $vers= $MTR_COMBINATION_VERS + $MTR_COMBINATION_VERS_TRX;
|
||||
if ($vers)
|
||||
{
|
||||
--disable_query_log
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('history','Deleted row ...');
|
||||
DELETE FROM articles;
|
||||
--enable_query_log
|
||||
}
|
||||
|
||||
# Drop the FTS index before more insertion. The FTS_DOC_ID should
|
||||
# be kept
|
||||
DROP INDEX title ON articles;
|
||||
|
@ -59,6 +70,13 @@ INSERT INTO articles (title,body) VALUES
|
|||
# Recreate fulltext index to see if everything is OK
|
||||
CREATE FULLTEXT INDEX idx ON articles (title,body);
|
||||
|
||||
if ($vers)
|
||||
{
|
||||
--disable_query_log
|
||||
UPDATE articles SET id= id - 1;
|
||||
--enable_query_log
|
||||
}
|
||||
|
||||
# Should return 3 rows
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
|
@ -98,6 +116,13 @@ disconnect dml;
|
|||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL Tutorial','DBMS stands for DataBase ...');
|
||||
|
||||
if ($vers)
|
||||
{
|
||||
--disable_query_log
|
||||
UPDATE articles SET id= id - 1 WHERE id > 8;
|
||||
--enable_query_log
|
||||
}
|
||||
|
||||
# Should return 6 rows
|
||||
SELECT * FROM articles
|
||||
WHERE MATCH (title,body)
|
||||
|
@ -134,6 +159,15 @@ BEGIN;
|
|||
INSERT INTO articles VALUES
|
||||
(100, 200, 'MySQL Tutorial','DBMS stands for DataBase ...');
|
||||
|
||||
if ($vers)
|
||||
{
|
||||
--disable_query_log
|
||||
DELETE FROM articles WHERE id = 100;
|
||||
INSERT INTO articles VALUES
|
||||
(100, 200, 'MySQL Tutorial','DBMS stands for DataBase ...');
|
||||
--enable_query_log
|
||||
}
|
||||
|
||||
connect(dml2, localhost, root,,);
|
||||
|
||||
--echo #
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
SET NAMES utf8mb4;
|
||||
|
||||
--echo #
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#
|
||||
|
||||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
CREATE TABLE t1 (
|
||||
i int(10) unsigned not null auto_increment primary key,
|
||||
|
@ -212,7 +213,17 @@ delete from t1 limit 1;
|
|||
#
|
||||
# BUG#16489: utf8 + fulltext leads to corrupt index file.
|
||||
#
|
||||
if ($MTR_COMBINATION_ORIG)
|
||||
{
|
||||
truncate table t1;
|
||||
}
|
||||
if (!$MTR_COMBINATION_ORIG)
|
||||
{
|
||||
--disable_query_log
|
||||
delete from t1;
|
||||
--enable_query_log
|
||||
--echo truncate table t1;
|
||||
}
|
||||
insert into t1 values('ab c d');
|
||||
update t1 set a='ab c d';
|
||||
select * from t1 where match a against('ab c' in boolean mode);
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
# test of new fulltext search features
|
||||
#
|
||||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
# Bugreport due to Roy Nasser <roy@vem.ca>
|
||||
#
|
||||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
# bug reported by Tibor Simko <tibor.simko@cern.ch>
|
||||
#
|
||||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1, t2;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
# Test for bug from Jean-Cédric COSTA <jean-cedric.costa@ensmp.fr>
|
||||
#
|
||||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists t1, t2;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
# several FULLTEXT indexes in one table test
|
||||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
--disable_warnings
|
||||
DROP TABLE IF EXISTS t1,t2,t3;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
# Test for bug by voi@ims.at
|
||||
#
|
||||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
--disable_warnings
|
||||
drop table if exists test;
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
# Fulltext configurable parameters
|
||||
#
|
||||
--source include/have_innodb.inc
|
||||
--source include/maybe_versioning.inc
|
||||
|
||||
# Save ft_boolean_syntax variable
|
||||
let $saved_ft_boolean_syntax=`select @@global.ft_boolean_syntax`;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# This is the DDL function tests for innodb FTS
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/maybe_versioning.inc
|
||||
|
||||
# Create FTS table
|
||||
CREATE TABLE fts_test (
|
||||
|
@ -54,7 +55,21 @@ SELECT * FROM fts_test WHERE MATCH (title,body)
|
|||
AGAINST ('+MySQL -YourSQL' IN BOOLEAN MODE);
|
||||
|
||||
# Truncate table
|
||||
let $vers=$MTR_COMBINATION_VERS+$MTR_COMBINATION_VERS_TRX;
|
||||
|
||||
if ($vers)
|
||||
{
|
||||
--disable_query_log
|
||||
CREATE TABLE fts_test2 LIKE fts_test;
|
||||
DROP TABLE fts_test;
|
||||
RENAME TABLE fts_test2 TO fts_test;
|
||||
--enable_query_log
|
||||
--echo TRUNCATE TABLE fts_test;
|
||||
}
|
||||
if (!$vers)
|
||||
{
|
||||
TRUNCATE TABLE fts_test;
|
||||
}
|
||||
|
||||
DROP INDEX idx ON fts_test;
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
# This is the basic function tests for innodb FTS
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
-- source include/maybe_versioning.inc
|
||||
|
||||
call mtr.add_suppression("\\[Warning\\] InnoDB: A new Doc ID must be supplied while updating FTS indexed columns.");
|
||||
call mtr.add_suppression("\\[Warning\\] InnoDB: FTS Doc ID must be larger than [0-9]+ for table `test`.`articles`");
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
--loose-innodb-ft-default-stopword
|
|
@ -1,664 +0,0 @@
|
|||
# This is the basic function tests for innodb FTS
|
||||
|
||||
-- source include/have_innodb.inc
|
||||
|
||||
|
||||
select * from information_schema.innodb_ft_default_stopword;
|
||||
|
||||
# Create FTS table
|
||||
CREATE TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
# Insert six rows
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL Tutorial','DBMS stands for DataBase ...') ,
|
||||
('How To Use MySQL Well','After you went through a ...'),
|
||||
('Optimizing MySQL','In this tutorial we will show ...'),
|
||||
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
|
||||
('MySQL vs. YourSQL','In the following database comparison ...'),
|
||||
('MySQL Security','When configured properly, MySQL ...');
|
||||
|
||||
# "the" is in the default stopword, it would not be selected
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('the' IN NATURAL LANGUAGE MODE);
|
||||
|
||||
let $innodb_ft_server_stopword_table_orig=`select @@innodb_ft_server_stopword_table`;
|
||||
let $innodb_ft_enable_stopword_orig=`select @@innodb_ft_enable_stopword`;
|
||||
let $innodb_ft_user_stopword_table_orig=`select @@innodb_ft_user_stopword_table`;
|
||||
|
||||
select @@innodb_ft_server_stopword_table;
|
||||
select @@innodb_ft_enable_stopword;
|
||||
select @@innodb_ft_user_stopword_table;
|
||||
|
||||
# Provide user defined stopword table, if not (correctly) defined,
|
||||
# it will be rejected
|
||||
--error 1231
|
||||
set global innodb_ft_server_stopword_table = "not_defined";
|
||||
|
||||
# Define a correct formated user stopword table
|
||||
create table user_stopword(value varchar(30)) engine = innodb;
|
||||
|
||||
# The set operation should be successful
|
||||
set global innodb_ft_server_stopword_table = "test/user_stopword";
|
||||
|
||||
drop index title on articles;
|
||||
|
||||
create fulltext index idx on articles(title, body);
|
||||
|
||||
# Now we should be able to find "the"
|
||||
SELECT * FROM articles WHERE MATCH (title,body)
|
||||
AGAINST ('the' IN NATURAL LANGUAGE MODE);
|
||||
|
||||
# Nothing inserted into the default stopword, so essentially
|
||||
# nothing get screened. The new stopword could only be
|
||||
# effective for table created thereafter
|
||||
CREATE TABLE articles_2 (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO articles_2 (title, body)
|
||||
VALUES ('test for stopwords','this is it...');
|
||||
|
||||
# Now we can find record with "this"
|
||||
SELECT * FROM articles_2 WHERE MATCH (title,body)
|
||||
AGAINST ('this' IN NATURAL LANGUAGE MODE);
|
||||
|
||||
# Ok, let's instantiate some value into user supplied stop word
|
||||
# table
|
||||
insert into user_stopword values("this");
|
||||
|
||||
# Ok, let's repeat with the new table again.
|
||||
CREATE TABLE articles_3 (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO articles_3 (title, body)
|
||||
VALUES ('test for stopwords','this is it...');
|
||||
|
||||
# Now we should NOT find record with "this"
|
||||
SELECT * FROM articles_3 WHERE MATCH (title,body)
|
||||
AGAINST ('this' IN NATURAL LANGUAGE MODE);
|
||||
|
||||
# Test session level stopword control "innodb_user_stopword_table"
|
||||
create table user_stopword_session(value varchar(30)) engine = innodb;
|
||||
|
||||
insert into user_stopword_session values("session");
|
||||
|
||||
set session innodb_ft_user_stopword_table="test/user_stopword_session";
|
||||
|
||||
CREATE TABLE articles_4 (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO articles_4 (title, body)
|
||||
VALUES ('test for session stopwords','this should also be excluded...');
|
||||
|
||||
# "session" is excluded
|
||||
SELECT * FROM articles_4 WHERE MATCH (title,body)
|
||||
AGAINST ('session' IN NATURAL LANGUAGE MODE);
|
||||
|
||||
# But we can find record with "this"
|
||||
SELECT * FROM articles_4 WHERE MATCH (title,body)
|
||||
AGAINST ('this' IN NATURAL LANGUAGE MODE);
|
||||
|
||||
--connect (con1,localhost,root,,)
|
||||
CREATE TABLE articles_5 (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
INSERT INTO articles_5 (title, body)
|
||||
VALUES ('test for session stopwords','this should also be excluded...');
|
||||
|
||||
# "session" should be found since the stopword table is session specific
|
||||
SELECT * FROM articles_5 WHERE MATCH (title,body)
|
||||
AGAINST ('session' IN NATURAL LANGUAGE MODE);
|
||||
|
||||
--connection default
|
||||
drop table articles;
|
||||
drop table articles_2;
|
||||
drop table articles_3;
|
||||
drop table articles_4;
|
||||
drop table articles_5;
|
||||
drop table user_stopword;
|
||||
drop table user_stopword_session;
|
||||
|
||||
eval SET GLOBAL innodb_ft_enable_stopword=$innodb_ft_enable_stopword_orig;
|
||||
eval SET GLOBAL innodb_ft_server_stopword_table=default;
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
# Behavior :
|
||||
# The stopword is loaded into memory at
|
||||
# 1) create fulltext index time,
|
||||
# 2) boot server,
|
||||
# 3) first time FTs is used
|
||||
# So if you already created a FTS index, and then turn off stopword
|
||||
# or change stopword table content it won't affect the FTS
|
||||
# that already created since the stopword list are already loaded.
|
||||
# It will only affect the new FTS index created after you changed
|
||||
# the settings.
|
||||
|
||||
# Create FTS table
|
||||
CREATE TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT `idx` (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
SHOW CREATE TABLE articles;
|
||||
|
||||
# Insert six rows
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL from Tutorial','DBMS stands for DataBase ...') ,
|
||||
('when To Use MySQL Well','After that you went through a ...'),
|
||||
('where will Optimizing MySQL','In what tutorial we will show ...'),
|
||||
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
|
||||
('MySQL vs. YourSQL','In the following database comparison ...'),
|
||||
('MySQL Security','When configured properly, MySQL ...');
|
||||
|
||||
# Case : server_stopword=default
|
||||
# Try to Search default stopword from innodb, "where", "will", "what"
|
||||
# and "when" are all stopwords
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
|
||||
# boolean No result expected
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
|
||||
# no result expected
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
|
||||
# no result expected
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
|
||||
|
||||
INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
|
||||
# Not going to update as where condition can not find record
|
||||
UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
|
||||
WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
# Update the record
|
||||
UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
|
||||
WHERE id = 7;
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
# Delete will not work as where condition do not return
|
||||
DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE id = 7;
|
||||
DELETE FROM articles WHERE id = 7;
|
||||
|
||||
|
||||
|
||||
# Case : Turn OFF stopword list variable and search stopword on OLD index.
|
||||
# disable stopword list
|
||||
#SET global innodb_ft_server_stopword_table = "";
|
||||
SET SESSION innodb_ft_enable_stopword = 0;
|
||||
select @@innodb_ft_enable_stopword;
|
||||
#SET global innodb_ft_user_stopword_table = "";
|
||||
|
||||
# search default stopword with innodb_ft_enable_stopword is OFF.
|
||||
# No records expected even though we turned OFF stopwod filtering
|
||||
# (refer Behavior (at the top of the test) for explanation )
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
|
||||
|
||||
INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
|
||||
# Not going to update as where condition can not find record
|
||||
UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
|
||||
WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
# Update the record
|
||||
UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
|
||||
WHERE id = 8;
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
SELECT * FROM articles WHERE id = 8;
|
||||
# Delete will not work as where condition do not return
|
||||
DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE id = 8;
|
||||
DELETE FROM articles WHERE id = 8;
|
||||
|
||||
# Case : Turn OFF stopword list variable and search stopword on NEW index.
|
||||
# Drop index
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
SHOW CREATE TABLE articles;
|
||||
|
||||
# Create the FTS index Using Alter Table.
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
|
||||
ANALYZE TABLE articles;
|
||||
|
||||
# search default stopword with innodb_ft_enable_stopword is OFF.
|
||||
# All records expected as stopwod filtering is OFF and we created
|
||||
# new FTS index.
|
||||
# (refer Behavior (at the top of the test) for explanation )
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
|
||||
|
||||
INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
|
||||
# Update will succeed.
|
||||
UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
|
||||
WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
|
||||
SELECT COUNT(*),max(id) FROM articles;
|
||||
# Update the record - uncommet on fix
|
||||
#UPDATE articles SET title = "update the record" , body = 'to see will is indexed or not'
|
||||
#WHERE id = 9;
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
# Delete will succeed.
|
||||
DELETE FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE id = 9;
|
||||
|
||||
|
||||
DROP TABLE articles;
|
||||
|
||||
eval SET SESSION innodb_ft_enable_stopword=$innodb_ft_enable_stopword_orig;
|
||||
#eval SET GLOBAL innodb_ft_server_stopword_table=$innodb_ft_server_stopword_table_orig;
|
||||
eval SET GLOBAL innodb_ft_server_stopword_table=default;
|
||||
#eval SET GLOBAL innodb_ft_user_stopword_table=$innodb_ft_user_stopword_table_orig;
|
||||
eval SET SESSION innodb_ft_user_stopword_table=default;
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
|
||||
select @@innodb_ft_server_stopword_table;
|
||||
select @@innodb_ft_enable_stopword;
|
||||
select @@innodb_ft_user_stopword_table;
|
||||
|
||||
# Create FTS table
|
||||
CREATE TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT `idx` (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
# Insert six rows
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL from Tutorial','DBMS stands for DataBase ...') ,
|
||||
('when To Use MySQL Well','After that you went through a ...'),
|
||||
('where will Optimizing MySQL','In what tutorial we will show ...'),
|
||||
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
|
||||
('MySQL vs. YourSQL','In the following database comparison ...'),
|
||||
('MySQL Security','When configured properly, MySQL ...');
|
||||
|
||||
# No records expeced for select
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
# Define a correct formated user stopword table
|
||||
create table user_stopword(value varchar(30)) engine = innodb;
|
||||
# The set operation should be successful
|
||||
set session innodb_ft_user_stopword_table = "test/user_stopword";
|
||||
# Define a correct formated server stopword table
|
||||
create table server_stopword(value varchar(30)) engine = innodb;
|
||||
# The set operation should be successful
|
||||
set global innodb_ft_server_stopword_table = "test/server_stopword";
|
||||
# Add values into user supplied stop word table
|
||||
insert into user_stopword values("this"),("will"),("the");
|
||||
|
||||
# Drop existing index and create the FTS index Using Alter Table.
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
|
||||
# Add values into server supplied stop word table
|
||||
insert into server_stopword values("what"),("where");
|
||||
# Follwoing should return result as server stopword list was empty at create index time
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
|
||||
|
||||
# Delete stopword from user list
|
||||
DELETE FROM user_stopword;
|
||||
# Drop existing index and create the FTS index Using Alter Table.
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
# Follwoing should return result even though to server stopword list
|
||||
# conatin these words. Session level stopword list takes priority
|
||||
# Here user_stopword is set using innodb_ft_user_stopword_table
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
|
||||
|
||||
# Follwoing should return result as user stopword list was empty at create index time
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
|
||||
# Add values into user supplied stop word table
|
||||
insert into user_stopword values("this"),("will"),("the");
|
||||
|
||||
# Drop existing index and create the FTS index Using Alter Table.
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
SET SESSION innodb_ft_enable_stopword = 0;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
|
||||
# Session level stopword list takes priority
|
||||
SET SESSION innodb_ft_enable_stopword = 1;
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
|
||||
# Make user stopword list deafult so as to server stopword list takes priority
|
||||
SET SESSION innodb_ft_enable_stopword = 1;
|
||||
SET SESSION innodb_ft_user_stopword_table = default;
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
|
||||
|
||||
DROP TABLE articles,user_stopword,server_stopword;
|
||||
|
||||
# Restore Defaults
|
||||
eval SET SESSION innodb_ft_enable_stopword=$innodb_ft_enable_stopword_orig;
|
||||
eval SET GLOBAL innodb_ft_server_stopword_table=default;
|
||||
eval SET SESSION innodb_ft_user_stopword_table=default;
|
||||
select @@innodb_ft_server_stopword_table;
|
||||
select @@innodb_ft_enable_stopword;
|
||||
select @@innodb_ft_user_stopword_table;
|
||||
|
||||
#---------------------------------------------------------------------------------------
|
||||
# Create FTS table
|
||||
CREATE TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT `idx` (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
SHOW CREATE TABLE articles;
|
||||
|
||||
# Insert six rows
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL from Tutorial','DBMS stands for DataBase ...') ,
|
||||
('when To Use MySQL Well','After that you went through a ...'),
|
||||
('where will Optimizing MySQL','In what tutorial we will show ...'),
|
||||
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
|
||||
('MySQL vs. YourSQL','In the following database comparison ...'),
|
||||
('MySQL Security','When configured properly, MySQL ...');
|
||||
|
||||
# No records expeced for select
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
# Define a correct formated user stopword table
|
||||
create table user_stopword(value varchar(30)) engine = innodb;
|
||||
# The set operation should be successful
|
||||
set session innodb_ft_user_stopword_table = "test/user_stopword";
|
||||
insert into user_stopword values("mysqld"),("DBMS");
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
|
||||
|
||||
|
||||
# Drop existing index and create the FTS index Using Alter Table.
|
||||
# user stopword list will take effect.
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
|
||||
|
||||
# set user stopword list empty
|
||||
set session innodb_ft_user_stopword_table = default;
|
||||
# Define a correct formated user stopword table
|
||||
create table server_stopword(value varchar(30)) engine = innodb;
|
||||
# The set operation should be successful
|
||||
set global innodb_ft_server_stopword_table = "test/server_stopword";
|
||||
insert into server_stopword values("root"),("properly");
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
|
||||
|
||||
|
||||
# set user stopword list empty
|
||||
set session innodb_ft_user_stopword_table = "test/user_stopword";
|
||||
# The set operation should be successful
|
||||
set global innodb_ft_server_stopword_table = "test/server_stopword";
|
||||
# user stopword list take effect as its session level
|
||||
# Result expected for select
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
|
||||
|
||||
# set user stopword list
|
||||
set session innodb_ft_user_stopword_table = "test/user_stopword";
|
||||
DELETE FROM user_stopword;
|
||||
# The set operation should be successful
|
||||
set global innodb_ft_server_stopword_table = "test/server_stopword";
|
||||
DELETE FROM server_stopword;
|
||||
# user stopword list take affect as its session level
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+wha* +where" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('what');
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+root +mysql" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('properly');
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+DBMS +mysql" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('mysqld');
|
||||
|
||||
DROP TABLE articles,user_stopword,server_stopword;
|
||||
|
||||
# Restore Values
|
||||
eval SET SESSION innodb_ft_enable_stopword=$innodb_ft_enable_stopword_orig;
|
||||
eval SET GLOBAL innodb_ft_server_stopword_table=default;
|
||||
eval SET SESSION innodb_ft_user_stopword_table=default;
|
||||
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
# FTS stopword list test - check varaibles across sessions
|
||||
|
||||
# Create FTS table
|
||||
CREATE TABLE articles (
|
||||
id INT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
|
||||
title VARCHAR(200),
|
||||
body TEXT,
|
||||
FULLTEXT `idx` (title,body)
|
||||
) ENGINE=InnoDB;
|
||||
|
||||
SHOW CREATE TABLE articles;
|
||||
|
||||
# Insert six rows
|
||||
INSERT INTO articles (title,body) VALUES
|
||||
('MySQL from Tutorial','DBMS stands for DataBase ...') ,
|
||||
('when To Use MySQL Well','After that you went through a ...'),
|
||||
('where will Optimizing MySQL','In what tutorial we will show ...'),
|
||||
('1001 MySQL Tricks','1. Never run mysqld as root. 2. ...'),
|
||||
('MySQL vs. YourSQL','In the following database comparison ...'),
|
||||
('MySQL Security','When configured properly, MySQL ...');
|
||||
|
||||
# session varaible innodb_ft_enable_stopword=0 will take effect for new FTS index
|
||||
SET SESSION innodb_ft_enable_stopword = 0;
|
||||
select @@innodb_ft_enable_stopword;
|
||||
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
|
||||
|
||||
--connection con1
|
||||
select @@innodb_ft_enable_stopword;
|
||||
|
||||
ANALYZE TABLE articles;
|
||||
|
||||
# result expected as index created before setting innodb_ft_enable_stopword varaible off
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
|
||||
|
||||
SET SESSION innodb_ft_enable_stopword = 1;
|
||||
select @@innodb_ft_enable_stopword;
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
# no result expected turned innodb_ft_enable_stopword is ON
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
|
||||
|
||||
|
||||
--connection default
|
||||
select @@innodb_ft_enable_stopword;
|
||||
# no result expected as word not indexed from connection 1
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("where will");
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("when");
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST ("what" WITH QUERY EXPANSION);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("whe*" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+what +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+from" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+where +(show what)" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@6' IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"where will"@9' IN BOOLEAN MODE);
|
||||
|
||||
INSERT INTO articles(title,body) values ('the record will' , 'not index the , will words');
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
|
||||
|
||||
SET SESSION innodb_ft_enable_stopword = 1;
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+the +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('"the will"@11' IN BOOLEAN MODE);
|
||||
|
||||
|
||||
--connection con1
|
||||
SET SESSION innodb_ft_enable_stopword = 1;
|
||||
# Define a correct formated user stopword table
|
||||
create table user_stopword(value varchar(30)) engine = innodb;
|
||||
# The set operation should be successful
|
||||
set session innodb_ft_user_stopword_table = "test/user_stopword";
|
||||
# Add values into user supplied stop word table
|
||||
insert into user_stopword values("this"),("will"),("the");
|
||||
# Drop existing index and create the FTS index Using Alter Table.
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
# no result expected as innodb_ft_user_stopword_table filter it
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
|
||||
|
||||
--connection default
|
||||
# no result expected as innodb_ft_user_stopword_table filter it from connection1
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+show +will" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('will');
|
||||
select @@innodb_ft_user_stopword_table;
|
||||
# Define a correct formated user stopword table
|
||||
create table user_stopword_1(value varchar(30)) engine = innodb;
|
||||
# The set operation should be successful
|
||||
set session innodb_ft_user_stopword_table = "test/user_stopword_1";
|
||||
insert into user_stopword_1 values("when");
|
||||
SET SESSION innodb_ft_enable_stopword = 1;
|
||||
# result expected
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when');
|
||||
# Drop existing index and create the FTS index Using Alter Table.
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
# no result expected
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('when');
|
||||
|
||||
--connection con1
|
||||
SET SESSION innodb_ft_enable_stopword = 1;
|
||||
SET SESSION innodb_ft_user_stopword_table=default;
|
||||
select @@innodb_ft_user_stopword_table;
|
||||
select @@innodb_ft_server_stopword_table;
|
||||
# Define a correct formated server stopword table
|
||||
create table server_stopword(value varchar(30)) engine = innodb;
|
||||
# The set operation should be successful
|
||||
SET GLOBAL innodb_ft_server_stopword_table = "test/server_stopword";
|
||||
select @@innodb_ft_server_stopword_table;
|
||||
insert into server_stopword values("when"),("the");
|
||||
# Drop existing index and create the FTS index Using Alter Table.
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
# no result expected
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the');
|
||||
|
||||
disconnect con1;
|
||||
--source include/wait_until_disconnected.inc
|
||||
|
||||
--connection default
|
||||
SET SESSION innodb_ft_enable_stopword = 1;
|
||||
SET SESSION innodb_ft_user_stopword_table=default;
|
||||
select @@innodb_ft_server_stopword_table;
|
||||
# result expected
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
|
||||
insert into server_stopword values("where"),("will");
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
|
||||
ALTER TABLE articles DROP INDEX idx;
|
||||
ALTER TABLE articles ADD FULLTEXT INDEX idx (title,body);
|
||||
# no result expected
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+when" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('the');
|
||||
SELECT * FROM articles WHERE MATCH(title,body) AGAINST("+will +where" IN BOOLEAN MODE);
|
||||
SELECT * FROM articles WHERE MATCH (title,body) AGAINST ('where');
|
||||
|
||||
|
||||
DROP TABLE articles,user_stopword,user_stopword_1,server_stopword;
|
||||
|
||||
# Restore Values
|
||||
eval SET SESSION innodb_ft_enable_stopword=$innodb_ft_enable_stopword_orig;
|
||||
eval SET GLOBAL innodb_ft_server_stopword_table=default;
|
||||
eval SET SESSION innodb_ft_user_stopword_table=default;
|
||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue