-
Notifications
You must be signed in to change notification settings - Fork 0
/
SPIDER.sql
117 lines (88 loc) · 2.89 KB
/
SPIDER.sql
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
/*
This file contains examples about the SPIDER storage engine.
Please copy the data files in the proper directories and adjust the paths.
Then, you can paste the snippets into your favourite MariaDB client and see the results.
SPIDER documentation on MariaDB KB:
https://mariadb.com/kb/en/spider/
SPIDER's official website:
http://spiderformysql.com/
*/
// MDEV-6096
// MDEV-5632
\W
INSTALL SONAME 'ha_spider';
SELECT * FROM information_schema.ENGINES
WHERE ENGINE = 'SPIDER' \G
SOURCE /usr/local/mysql/share/install_spider.sql
SOURCE /usr/share/mysql/install_spider.sql
SHOW TABLES FROM mysql LIKE 'spider%';
SHOW VARIABLES LIKE 'spider%';
SHOW STATUS LIKE 'spider%';
CREATE DATABASE IF NOT EXISTS maria10_snippets;
CREATE DATABASE IF NOT EXISTS maria10_snippets_1;
CREATE DATABASE IF NOT EXISTS maria10_snippets_2;
USE maria10_snippets;
CREATE OR REPLACE TABLE maria10_snippets_1.site_user
(
id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY
, first_name CHAR(50) NOT NULL
, last_name CHAR(50) NOT NULL
, email CHAR(255) NOT NULL
, UNIQUE INDEX unq_last_name (email)
)
ENGINE = InnoDB
;
INSERT INTO maria10_snippets_1.site_user (first_name, last_name, email) VALUES
('Mario', 'Rossi', '[email protected]')
, ('Mauro', 'Verdi', '[email protected]')
, ('Marco', 'Bianchi', '[email protected]')
;
CREATE OR REPLACE TABLE maria10_snippets_2.site_user
(
id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY
, first_name CHAR(50) NOT NULL
, last_name CHAR(50) NOT NULL
, email CHAR(255) NOT NULL
, UNIQUE INDEX unq_last_name (email)
)
ENGINE = InnoDB
AUTO_INCREMENT = 10000
;
INSERT INTO maria10_snippets_2.site_user (first_name, last_name, email) VALUES
('Elena', 'Rossi', '[email protected]')
, ('Viviana', 'Verdi', '[email protected]')
, ('Monica', 'Bianchi', '[email protected]')
;
CREATE USER 'spider'@'localhost';
SET PASSWORD FOR 'spider'@'localhost' = PASSWORD('pspider');
GRANT ALL ON *.* TO 'spider'@'localhost';
CREATE OR REPLACE TABLE site_user
(
id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY
, first_name CHAR(50) NOT NULL
, last_name CHAR(50) NOT NULL
, email CHAR(255) NOT NULL
, UNIQUE INDEX unq_last_name (email)
)
ENGINE = SPIDER
COMMENT 'host "127.0.0.1", user "spider", password "pspider", database "maria10_snippets_1", table "site_user"'
;
SELECT * FROM site_user;
CREATE OR REPLACE TABLE site_user
(
id INTEGER NOT NULL AUTO_INCREMENT PRIMARY KEY
, first_name CHAR(50) NOT NULL
, last_name CHAR(50) NOT NULL
, email CHAR(255) NOT NULL
, INDEX unq_last_name (email)
)
ENGINE = SPIDER
PARTITION BY RANGE (id)
(
PARTITION p0 VALUES LESS THAN (10000)
COMMENT = 'host "127.0.0.1", user "spider", password "pspider", database "maria10_snippets_1", table "site_user"',
PARTITION p1 VALUES LESS THAN (20000)
COMMENT = 'host "127.0.0.1", user "spider", password "pspider", database "maria10_snippets_2", table "site_user"'
);
SELECT * FROM site_user;
-- @@spider_general_log server