AnonSec Shell
Server IP : 185.86.78.101  /  Your IP : 216.73.216.124
Web Server : Apache
System : Linux 675867-vds-valikoshka1996.gmhost.pp.ua 5.4.0-150-generic #167-Ubuntu SMP Mon May 15 17:35:05 UTC 2023 x86_64
User : www ( 1000)
PHP Version : 7.4.33
Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF  |  Sudo : ON  |  Pkexec : OFF
Directory :  /www/server/mysql/mysql-test/t/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ HOME ]     

Current File : /www/server/mysql/mysql-test/t/partition_hash.test
#--disable_abort_on_error
#
# Simple test for the partition storage engine
# Taken fromm the select test
#
-- source include/have_partition.inc

--disable_warnings
drop table if exists t1;
--enable_warnings

--echo #
--echo # Bug#12725206/Bug#61765: WRONG QUERY RESULTS ON SUBPARTITIONS BASED
--echo #                         ON USIGNED BIGINT
--echo #
CREATE TABLE t1 (
 a int(11) NOT NULL,
 b bigint(20) UNSIGNED NOT NULL
)
PARTITION BY RANGE (a)
SUBPARTITION BY HASH (b)
SUBPARTITIONS 3
(PARTITION p1 VALUES LESS THAN (1308614400),
 PARTITION p2 VALUES LESS THAN (1308700800),
 PARTITION p3 VALUES LESS THAN (1308787200),
 PARTITION p4 VALUES LESS THAN (1308873600),
 PARTITION p5 VALUES LESS THAN (1308960000)
);

INSERT INTO t1 VALUES
(1308614400,18446744073709551615),
(1308700800,0xFFFFFFFFFFFFFFFE),
(1308787200,18446744073709551613),
(1308873600,18446744073709551612),
(1308873600, 12531568256096620965),
(1308873600, 12531568256096),
(1308873600, 9223372036854775808);
SELECT a,b,HEX(b) FROM t1 ORDER BY a, b;

--echo # The following queries returned nothing

SELECT * FROM t1 WHERE b = 9223372036854775808;
SELECT * FROM t1 WHERE b = 18446744073709551612;
SELECT * FROM t1 WHERE b = 18446744073709551615;
analyze table t1;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = 9223372036854775808;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = 18446744073709551612;
EXPLAIN PARTITIONS SELECT * FROM t1 WHERE b = 18446744073709551615;
DROP TABLE t1;

#
# Bug#30822: crash when COALESCE
#
CREATE TABLE t1 (c1 INT)
  PARTITION BY HASH (c1)
  PARTITIONS 15;
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
ALTER TABLE t1 COALESCE PARTITION 13;
DROP TABLE t1;
CREATE TABLE t1 (c1 INT)
  PARTITION BY LINEAR HASH (c1)
  PARTITIONS 5;
INSERT INTO t1 VALUES (1), (2), (3), (4), (5);
ALTER TABLE t1 COALESCE PARTITION 3;
DROP TABLE t1;

#
# More partition pruning tests, especially on interval walking
#
create table t1 (a int unsigned)
partition by hash(a div 2)
partitions 4;
insert into t1 values (null),(0),(1),(2),(3),(4),(5),(6),(7);
select * from t1 where a < 0;
select * from t1 where a is null or (a >= 5 and a <= 7);
select * from t1 where a is null;
select * from t1 where a is not null;
select * from t1 where a >= 1 and a < 3;
select * from t1 where a >= 3 and a <= 5;
select * from t1 where a > 2 and a < 4;
select * from t1 where a > 3 and a <= 6;
select * from t1 where a > 5;
select * from t1 where a >= 1 and a <= 5;
analyze table t1;
explain partitions select * from t1 where a < 0;
explain partitions select * from t1 where a is null or (a >= 5 and a <= 7); 
explain partitions select * from t1 where a is null;
explain partitions select * from t1 where a is not null;
explain partitions select * from t1 where a >= 1 and a < 3;
explain partitions select * from t1 where a >= 3 and a <= 5;
explain partitions select * from t1 where a > 2 and a < 4;
explain partitions select * from t1 where a > 3 and a <= 6;
explain partitions select * from t1 where a > 5;
explain partitions select * from t1 where a >= 1 and a <= 5;

drop table t1;

#
# Partition by hash, basic
#
CREATE TABLESPACE ts1 ADD DATAFILE 'ts1.ibd';
CREATE TABLESPACE ts2 ADD DATAFILE 'ts2.ibd';
CREATE TABLESPACE ts3 ADD DATAFILE 'ts3.ibd';
CREATE TABLE t1 (
a int not null,
b int not null,
c int not null,
primary key(a,b))
partition by hash (a + 2)
partitions 3
(partition x1 tablespace ts1,
 partition x2 tablespace ts2,
 partition x3 tablespace ts3);

insert into t1 values (1,1,1);
SHOW CREATE TABLE t1;
insert into t1 values (2,1,1);
insert into t1 values (3,1,1);
insert into t1 values (4,1,1);
insert into t1 values (5,1,1);

select * from t1;

update t1 set c=3 where b=1;
select * from t1;

select b from t1 where a=3;
select b,c from t1 where a=1 AND b=1;

delete from t1 where a=1;
delete from t1 where c=3;

select * from t1;

ALTER TABLE t1
partition by hash (a + 3)
partitions 3
(partition x1 tablespace ts1,
 partition x2 tablespace ts2,
 partition x3 tablespace ts3);
select * from t1;
SHOW CREATE TABLE t1;
drop table t1;
DROP TABLESPACE ts1;
DROP TABLESPACE ts2;
DROP TABLESPACE ts3;

#
# Partition by hash, only one partition
#
CREATE TABLE t1 (
a int not null,
b int not null,
c int not null,
primary key(a,b))
partition by hash (a)
(partition x1);

drop table t1;
#
# Partition by key, only one partition
#
CREATE TABLE t1 (
a int not null,
b int not null,
c int not null,
primary key(a,b))
partition by key (a)
(partition x1);

drop table t1;

#
# Bug# 15968 - crash when INSERT with f1 = -1 into partition by hash(f1)
#
CREATE TABLE t1 (f1 INTEGER, f2 char(20)) PARTITION BY HASH(f1) PARTITIONS 2;
INSERT INTO t1 SET f1 = 0 - 1, f2 = '#######';
select * from t1;
drop table t1;

#
# BUG 18423 Hash partitioning can lose rows in some queries
#
create table t1 (c1 int DEFAULT NULL,
                 c2 varchar (30) DEFAULT NULL,
                 c3 date DEFAULT NULL)
partition by hash (to_days(c3))
partitions 12;

insert into t1 values
(136,'abc','2002-01-05'),(142,'abc','2002-02-14'),(162,'abc','2002-06-28'),
(182,'abc','2002-11-09'),(158,'abc','2002-06-01'),(184,'abc','2002-11-22');
select * from t1;
select * from t1 where c3 between '2002-01-01' and '2002-12-31';

drop table t1;


Anon7 - 2022
AnonSec Team