File: partition_geometries.result

package info (click to toggle)
mariadb 1%3A11.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 772,520 kB
  • sloc: ansic: 2,414,714; cpp: 1,791,394; asm: 381,336; perl: 62,905; sh: 49,647; pascal: 40,897; java: 39,363; python: 20,791; yacc: 20,432; sql: 17,907; xml: 12,344; ruby: 8,544; cs: 6,542; makefile: 6,145; ada: 1,879; lex: 1,193; javascript: 996; objc: 80; tcl: 73; awk: 46; php: 22
file content (125 lines) | stat: -rw-r--r-- 4,491 bytes parent folder | download | duplicates (2)
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
117
118
119
120
121
122
123
124
125
#
# MDEV-19177: Geometry support for partition feature
# Test partition/geometry type cross-compatibility for the 4 storage engines that support
# geometries (Aria, MyISAM, InnoDB, Archive)
# Geometries to test - point, multipolygon, geometry collection 
# Note: Archive does not support additional indices.
#
SET @point = Point(3,3);
SET @poly = MultiPolygon(Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))));
SET @collection = GeometryCollection(Point(1,1), Polygon(LineString(Point(0, 3), Point(3, 3), Point(3, 0), Point(0, 3))));
#
# Aria engine
#
CREATE TABLE t1 (
`id` int(11) NOT NULL AUTO_INCREMENT,
`geom` geometry NOT NULL,
PRIMARY KEY (id),
SPATIAL INDEX(geom)
) Engine=Aria PARTITION BY HASH (id)
PARTITIONS 10;
INSERT INTO t1 VALUES (NULL, @point), (NULL, @poly), (NULL, @collection);
SELECT ST_AsGeoJSON(geom) FROM t1;
ST_AsGeoJSON(geom)
{"type": "Point", "coordinates": [3, 3]}
{"type": "MultiPolygon", "coordinates": [[[[0, 3], [3, 3], [3, 0], [0, 3]]]]}
{"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [1, 1]}, {"type": "Polygon", "coordinates": [[[0, 3], [3, 3], [3, 0], [0, 3]]]}]}
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `geom` geometry NOT NULL,
  PRIMARY KEY (`id`),
  SPATIAL KEY `geom` (`geom`)
) ENGINE=Aria AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
 PARTITION BY HASH (`id`)
PARTITIONS 10
DROP TABLE t1;
#
# MyISAM engine
#
CREATE TABLE t1 (
`id` int(11) NOT NULL AUTO_INCREMENT,
`geom` geometry NOT NULL,
PRIMARY KEY (id),
SPATIAL INDEX(geom)
) Engine=myisam PARTITION BY HASH (id)
PARTITIONS 10;
INSERT INTO t1 VALUES (NULL, @point), (NULL, @poly), (NULL, @collection);
SELECT ST_AsGeoJSON(geom) FROM t1;
ST_AsGeoJSON(geom)
{"type": "Point", "coordinates": [3, 3]}
{"type": "MultiPolygon", "coordinates": [[[[0, 3], [3, 3], [3, 0], [0, 3]]]]}
{"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [1, 1]}, {"type": "Polygon", "coordinates": [[[0, 3], [3, 3], [3, 0], [0, 3]]]}]}
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `geom` geometry NOT NULL,
  PRIMARY KEY (`id`),
  SPATIAL KEY `geom` (`geom`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
 PARTITION BY HASH (`id`)
PARTITIONS 10
DROP TABLE t1;
#
# InnoDB engine
#
CREATE TABLE t1 (
`id` int(11) NOT NULL AUTO_INCREMENT,
`geom` geometry NOT NULL,
PRIMARY KEY (id),
SPATIAL INDEX(geom)
) Engine=innodb PARTITION BY HASH (id)
PARTITIONS 10;
INSERT INTO t1 VALUES (NULL, @point), (NULL, @poly), (NULL, @collection);
SELECT ST_AsGeoJSON(geom) FROM t1;
ST_AsGeoJSON(geom)
{"type": "Point", "coordinates": [3, 3]}
{"type": "MultiPolygon", "coordinates": [[[[0, 3], [3, 3], [3, 0], [0, 3]]]]}
{"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [1, 1]}, {"type": "Polygon", "coordinates": [[[0, 3], [3, 3], [3, 0], [0, 3]]]}]}
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `geom` geometry NOT NULL,
  PRIMARY KEY (`id`),
  SPATIAL KEY `geom` (`geom`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
 PARTITION BY HASH (`id`)
PARTITIONS 10
DROP TABLE t1;
#
# Archive engine
#
INSTALL SONAME 'ha_archive';
CREATE TABLE t1 (
`id` int(11) NOT NULL AUTO_INCREMENT,
`geom` geometry,
SPATIAL INDEX(geom)
) Engine=archive PARTITION BY HASH (id)
PARTITIONS 10;
ERROR HY000: The storage engine partition doesn't support SPATIAL indexes
CREATE TABLE t1 (
`id` int(11) NOT NULL AUTO_INCREMENT,
`geom` geometry,
PRIMARY KEY (id)
) Engine=archive PARTITION BY HASH (id)
PARTITIONS 10;
INSERT INTO t1 VALUES (NULL, @point), (NULL, @poly), (NULL, @collection);
SELECT ST_AsGeoJSON(geom) FROM t1;
ST_AsGeoJSON(geom)
{"type": "Point", "coordinates": [3, 3]}
{"type": "MultiPolygon", "coordinates": [[[[0, 3], [3, 3], [3, 0], [0, 3]]]]}
{"type": "GeometryCollection", "geometries": [{"type": "Point", "coordinates": [1, 1]}, {"type": "Polygon", "coordinates": [[[0, 3], [3, 3], [3, 0], [0, 3]]]}]}
SHOW CREATE TABLE t1;
Table	Create Table
t1	CREATE TABLE `t1` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `geom` geometry DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=ARCHIVE AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_uca1400_ai_ci
 PARTITION BY HASH (`id`)
PARTITIONS 10
DROP TABLE t1;
UNINSTALL SONAME 'ha_archive';