rabbit-slide-kou-mysql-and-postgresql-and-japanese-full-text-search 2016.2.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.rabbit +1 -0
- data/README.rd +24 -0
- data/Rakefile +17 -0
- data/config.yaml +26 -0
- data/images/groonga-logo.svg +118 -0
- data/images/mroonga-icon-full-size.svg +97 -0
- data/images/mroonga-logo.svg +106 -0
- data/images/mysql-storage-engine.svg +302 -0
- data/images/pgroonga-icon-full-size.svg +68 -0
- data/images/pgroonga-logo.svg +84 -0
- data/images/position.svg +347 -0
- data/images/postgresql-index-access-method.svg +353 -0
- data/mroonga-and-pgroonga.rab +506 -0
- data/pdf/mysql-and-postgresql-and-japanese-full-text-search-mroonga-and-pgroonga.pdf +0 -0
- metadata +86 -0
@@ -0,0 +1,353 @@
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
2
|
+
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
3
|
+
|
4
|
+
<svg
|
5
|
+
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
6
|
+
xmlns:cc="http://creativecommons.org/ns#"
|
7
|
+
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
8
|
+
xmlns:svg="http://www.w3.org/2000/svg"
|
9
|
+
xmlns="http://www.w3.org/2000/svg"
|
10
|
+
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
11
|
+
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
12
|
+
width="112.90009mm"
|
13
|
+
height="67.246666mm"
|
14
|
+
viewBox="0 0 400.03967 238.27559"
|
15
|
+
id="svg2"
|
16
|
+
version="1.1"
|
17
|
+
inkscape:version="0.91 r13725"
|
18
|
+
sodipodi:docname="postgresql-index-access-method.svg">
|
19
|
+
<defs
|
20
|
+
id="defs4">
|
21
|
+
<marker
|
22
|
+
inkscape:isstock="true"
|
23
|
+
style="overflow:visible"
|
24
|
+
id="marker8735"
|
25
|
+
refX="0"
|
26
|
+
refY="0"
|
27
|
+
orient="auto"
|
28
|
+
inkscape:stockid="Arrow1Mend">
|
29
|
+
<path
|
30
|
+
inkscape:connector-curvature="0"
|
31
|
+
transform="matrix(-0.4,0,0,-0.4,-4,0)"
|
32
|
+
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
|
33
|
+
d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z"
|
34
|
+
id="path8737" />
|
35
|
+
</marker>
|
36
|
+
<marker
|
37
|
+
inkscape:stockid="Arrow1Mend"
|
38
|
+
orient="auto"
|
39
|
+
refY="0"
|
40
|
+
refX="0"
|
41
|
+
id="Arrow1Mend"
|
42
|
+
style="overflow:visible"
|
43
|
+
inkscape:isstock="true"
|
44
|
+
inkscape:collect="always">
|
45
|
+
<path
|
46
|
+
id="path4194"
|
47
|
+
d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z"
|
48
|
+
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
|
49
|
+
transform="matrix(-0.4,0,0,-0.4,-4,0)"
|
50
|
+
inkscape:connector-curvature="0" />
|
51
|
+
</marker>
|
52
|
+
<marker
|
53
|
+
inkscape:stockid="Arrow1Mstart"
|
54
|
+
orient="auto"
|
55
|
+
refY="0"
|
56
|
+
refX="0"
|
57
|
+
id="Arrow1Mstart"
|
58
|
+
style="overflow:visible"
|
59
|
+
inkscape:isstock="true">
|
60
|
+
<path
|
61
|
+
id="path4191"
|
62
|
+
d="M 0,0 5,-5 -12.5,0 5,5 0,0 Z"
|
63
|
+
style="fill:#000000;fill-opacity:1;fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1"
|
64
|
+
transform="matrix(0.4,0,0,0.4,4,0)"
|
65
|
+
inkscape:connector-curvature="0" />
|
66
|
+
</marker>
|
67
|
+
<linearGradient
|
68
|
+
y2="228.2177"
|
69
|
+
x2="223.6167"
|
70
|
+
y1="166.2236"
|
71
|
+
x1="223.6167"
|
72
|
+
gradientUnits="userSpaceOnUse"
|
73
|
+
id="SVGID_2_"
|
74
|
+
gradientTransform="translate(405.03952,235.75369)">
|
75
|
+
<stop
|
76
|
+
id="stop3925"
|
77
|
+
style="stop-color:#F8BB5E"
|
78
|
+
offset="0" />
|
79
|
+
<stop
|
80
|
+
id="stop3927"
|
81
|
+
style="stop-color:#FF931E"
|
82
|
+
offset="1" />
|
83
|
+
</linearGradient>
|
84
|
+
</defs>
|
85
|
+
<sodipodi:namedview
|
86
|
+
id="base"
|
87
|
+
pagecolor="#ffffff"
|
88
|
+
bordercolor="#666666"
|
89
|
+
borderopacity="1.0"
|
90
|
+
inkscape:pageopacity="0.0"
|
91
|
+
inkscape:pageshadow="2"
|
92
|
+
inkscape:zoom="1.4142136"
|
93
|
+
inkscape:cx="258.25512"
|
94
|
+
inkscape:cy="188.94427"
|
95
|
+
inkscape:document-units="px"
|
96
|
+
inkscape:current-layer="layer1"
|
97
|
+
showgrid="false"
|
98
|
+
inkscape:window-width="1920"
|
99
|
+
inkscape:window-height="1016"
|
100
|
+
inkscape:window-x="1920"
|
101
|
+
inkscape:window-y="27"
|
102
|
+
inkscape:window-maximized="1"
|
103
|
+
fit-margin-top="5"
|
104
|
+
fit-margin-left="5"
|
105
|
+
fit-margin-bottom="5"
|
106
|
+
fit-margin-right="5" />
|
107
|
+
<metadata
|
108
|
+
id="metadata7">
|
109
|
+
<rdf:RDF>
|
110
|
+
<cc:Work
|
111
|
+
rdf:about="">
|
112
|
+
<dc:format>image/svg+xml</dc:format>
|
113
|
+
<dc:type
|
114
|
+
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
115
|
+
<dc:title></dc:title>
|
116
|
+
</cc:Work>
|
117
|
+
</rdf:RDF>
|
118
|
+
</metadata>
|
119
|
+
<g
|
120
|
+
inkscape:label="レイヤー 1"
|
121
|
+
inkscape:groupmode="layer"
|
122
|
+
id="layer1"
|
123
|
+
transform="translate(-29.766222,-233.11521)">
|
124
|
+
<text
|
125
|
+
xml:space="preserve"
|
126
|
+
style="font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:20px;line-height:125%;font-family:'DejaVu Sans';-inkscape-font-specification:'DejaVu Sans, Normal';text-align:start;letter-spacing:0px;word-spacing:0px;writing-mode:lr-tb;text-anchor:start;fill:#008bb9;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;"
|
127
|
+
x="59.309708"
|
128
|
+
y="312.28235"
|
129
|
+
id="text4138"
|
130
|
+
sodipodi:linespacing="125%"><tspan
|
131
|
+
sodipodi:role="line"
|
132
|
+
id="tspan4140"
|
133
|
+
x="59.309708"
|
134
|
+
y="312.28235">PostgreSQL</tspan></text>
|
135
|
+
<text
|
136
|
+
xml:space="preserve"
|
137
|
+
style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
138
|
+
x="173.35533"
|
139
|
+
y="265.63174"
|
140
|
+
id="text4165"
|
141
|
+
sodipodi:linespacing="125%"><tspan
|
142
|
+
sodipodi:role="line"
|
143
|
+
id="tspan4167"
|
144
|
+
x="173.35533"
|
145
|
+
y="265.63174">SQL</tspan></text>
|
146
|
+
<text
|
147
|
+
xml:space="preserve"
|
148
|
+
style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
149
|
+
x="234.82338"
|
150
|
+
y="362.65512"
|
151
|
+
id="text4169"
|
152
|
+
sodipodi:linespacing="125%"><tspan
|
153
|
+
sodipodi:role="line"
|
154
|
+
id="tspan4171"
|
155
|
+
x="234.82338"
|
156
|
+
y="362.65512">insert/search/...</tspan></text>
|
157
|
+
<text
|
158
|
+
xml:space="preserve"
|
159
|
+
style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;text-align:center;letter-spacing:0px;word-spacing:0px;text-anchor:middle;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
160
|
+
x="304.73743"
|
161
|
+
y="400.86221"
|
162
|
+
id="text4173"
|
163
|
+
sodipodi:linespacing="125%"><tspan
|
164
|
+
sodipodi:role="line"
|
165
|
+
x="304.73743"
|
166
|
+
y="400.86221"
|
167
|
+
id="tspan4489">インデックスAM</tspan><tspan
|
168
|
+
sodipodi:role="line"
|
169
|
+
x="304.73743"
|
170
|
+
y="428.17426"
|
171
|
+
id="tspan4177" /></text>
|
172
|
+
<text
|
173
|
+
xml:space="preserve"
|
174
|
+
style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
175
|
+
x="200.22539"
|
176
|
+
y="313.36221"
|
177
|
+
id="text4495"
|
178
|
+
sodipodi:linespacing="125%"><tspan
|
179
|
+
sodipodi:role="line"
|
180
|
+
x="200.22539"
|
181
|
+
y="313.36221"
|
182
|
+
id="tspan4387">インデックス関連だけ</tspan><tspan
|
183
|
+
sodipodi:role="line"
|
184
|
+
x="200.22539"
|
185
|
+
y="338.36221"
|
186
|
+
id="tspan4391">インデックスAMへ</tspan></text>
|
187
|
+
<text
|
188
|
+
sodipodi:linespacing="125%"
|
189
|
+
id="text4823"
|
190
|
+
y="439.65414"
|
191
|
+
x="196.92924"
|
192
|
+
style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
193
|
+
xml:space="preserve"><tspan
|
194
|
+
y="439.65414"
|
195
|
+
x="196.92924"
|
196
|
+
id="tspan4825"
|
197
|
+
sodipodi:role="line">GIN</tspan></text>
|
198
|
+
<text
|
199
|
+
xml:space="preserve"
|
200
|
+
style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
201
|
+
x="246.46227"
|
202
|
+
y="435.31531"
|
203
|
+
id="text4827"
|
204
|
+
sodipodi:linespacing="125%"><tspan
|
205
|
+
sodipodi:role="line"
|
206
|
+
id="tspan4829"
|
207
|
+
x="246.46227"
|
208
|
+
y="435.31531">...</tspan></text>
|
209
|
+
<rect
|
210
|
+
y="413.27939"
|
211
|
+
x="190.93445"
|
212
|
+
height="38.894867"
|
213
|
+
width="46.215725"
|
214
|
+
id="rect4842"
|
215
|
+
style="fill:none;fill-opacity:1;stroke:#5382a1;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
216
|
+
ry="5"
|
217
|
+
rx="5" />
|
218
|
+
<rect
|
219
|
+
rx="5"
|
220
|
+
ry="5"
|
221
|
+
y="413.27939"
|
222
|
+
x="280.93503"
|
223
|
+
height="38.894867"
|
224
|
+
width="129.65433"
|
225
|
+
id="rect4853"
|
226
|
+
style="fill:none;fill-opacity:1;stroke:#5382a1;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
227
|
+
<rect
|
228
|
+
style="fill:none;fill-opacity:1;stroke:#008bb9;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
229
|
+
id="rect4136"
|
230
|
+
width="361.58536"
|
231
|
+
height="164.0229"
|
232
|
+
x="48.982758"
|
233
|
+
y="288.15137"
|
234
|
+
ry="5"
|
235
|
+
rx="5" />
|
236
|
+
<path
|
237
|
+
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow1Mend)"
|
238
|
+
d="m 188.45763,273.30333 0,80.27386 34.35813,0.36218 -0.26688,17.36217"
|
239
|
+
id="path4179"
|
240
|
+
inkscape:connector-curvature="0"
|
241
|
+
sodipodi:nodetypes="cccc" />
|
242
|
+
<rect
|
243
|
+
rx="5"
|
244
|
+
ry="5"
|
245
|
+
y="375.83261"
|
246
|
+
x="190.66817"
|
247
|
+
height="76.341644"
|
248
|
+
width="219.89995"
|
249
|
+
id="rect5058"
|
250
|
+
style="fill:none;fill-opacity:1;stroke:#5382a1;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
251
|
+
<rect
|
252
|
+
rx="5"
|
253
|
+
ry="5"
|
254
|
+
style="fill:none;fill-opacity:1;stroke:#5382a1;stroke-width:3;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
255
|
+
id="rect5069"
|
256
|
+
width="41.265976"
|
257
|
+
height="38.894867"
|
258
|
+
x="238.31059"
|
259
|
+
y="413.27939" />
|
260
|
+
<text
|
261
|
+
xml:space="preserve"
|
262
|
+
style="font-style:normal;font-weight:normal;font-size:12.5px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
263
|
+
x="233.2662"
|
264
|
+
y="260.39081"
|
265
|
+
id="text4393"
|
266
|
+
sodipodi:linespacing="125%"><tspan
|
267
|
+
sodipodi:role="line"
|
268
|
+
id="tspan4395"
|
269
|
+
x="233.2662"
|
270
|
+
y="260.39081">インデックスAM =</tspan><tspan
|
271
|
+
sodipodi:role="line"
|
272
|
+
x="233.2662"
|
273
|
+
y="277.46082"
|
274
|
+
id="tspan4397">インデックスアクセスメソッド</tspan></text>
|
275
|
+
<g
|
276
|
+
id="g4614"
|
277
|
+
transform="matrix(0.44543498,0,0,0.44543498,295.41673,414.41951)">
|
278
|
+
<path
|
279
|
+
id="path4616"
|
280
|
+
d="m 78.954,25.236 c -1.336,-0.289 -2.281,-0.447 -3.442,-0.447 -2.847,0 -5.33,0.831 -7.391,2.468 -0.091,0.06 -0.192,0.14 -0.303,0.245 -0.231,0.197 -0.452,0.406 -0.668,0.621 -1.479,1.314 -2.761,1.952 -2.761,-1.234 l 0,-0.666 c 0,-0.404 -0.327,-0.732 -0.731,-0.732 l -2.102,0 c -0.197,0 -0.388,0.08 -0.524,0.223 -0.14,0.143 -0.212,0.335 -0.206,0.532 0.104,3.333 0.215,6.778 0.215,9.621 l 0,18.75 c 0,0.403 0.328,0.731 0.731,0.731 l 2.21,0 c 0.403,0 0.731,-0.328 0.731,-0.731 l 0,-9.914 c 0,-1.37 0.107,-3.806 0.309,-4.813 1.57,-7.799 4.983,-11.59 10.436,-11.59 0.979,0 1.881,0.165 2.874,0.363 0.048,0.011 0.096,0.016 0.144,0.016 0.148,0 0.294,-0.045 0.417,-0.132 0.163,-0.112 0.273,-0.288 0.307,-0.483 l 0.322,-1.994 c 0.062,-0.385 -0.187,-0.752 -0.568,-0.834 z"
|
281
|
+
inkscape:connector-curvature="0"
|
282
|
+
style="fill:#030000" />
|
283
|
+
<path
|
284
|
+
id="path4618"
|
285
|
+
d="m 168,26.828 c -2.512,-1.774 -5.292,-2.04 -6.726,-2.04 -2.91,0 -5.648,0.912 -7.822,2.495 -0.005,0.004 -0.01,0.005 -0.015,0.009 -1.004,0.648 -2.627,0.909 -2.617,-0.625 l 0,-0.021 c 0.002,-0.106 -0.003,-0.198 -0.014,-0.276 l -0.008,-0.183 c -0.019,-0.391 -0.34,-0.697 -0.73,-0.697 l -2.103,0 c -0.203,0 -0.396,0.084 -0.535,0.232 -0.138,0.147 -0.209,0.346 -0.194,0.549 0.151,2.279 0.214,4.17 0.214,6.523 l 0,21.821 c 0,0.403 0.328,0.731 0.73,0.731 l 2.209,0 c 0.404,0 0.732,-0.328 0.732,-0.731 l 0,-17.51 c 0,-0.813 0.253,-1.762 0.49,-2.377 0.004,-0.008 0.006,-0.019 0.01,-0.026 1.043,-3.042 4.224,-6.12 8.417,-6.476 3.236,0.002 8.327,2.358 9.023,8.227 0.017,0.15 0.03,0.299 0.042,0.443 0.005,0.049 0.009,0.1 0.012,0.149 0.005,0.07 0.009,0.14 0.014,0.209 0.009,0.19 0.015,0.384 0.015,0.582 0,0.335 0.007,0.638 0.018,0.911 l 0,15.869 c 0,0.404 0.328,0.73 0.732,0.73 l 2.208,0 c 0.404,0 0.732,-0.328 0.732,-0.73 l 0,-16.271 C 172.835,32.97 171.208,29.097 168,26.828 Z"
|
286
|
+
inkscape:connector-curvature="0"
|
287
|
+
style="fill:#030000" />
|
288
|
+
<path
|
289
|
+
id="path4620"
|
290
|
+
d="m 244.224,52.17 c -0.133,-0.112 -0.301,-0.174 -0.473,-0.174 -0.04,0 -0.08,0.003 -0.12,0.01 -0.587,0.099 -0.965,0.099 -1.441,0.099 -1.147,0 -2.178,-0.336 -2.178,-4.387 l 0,-9.914 c 0,-2.343 -0.179,-5.367 -1.583,-7.972 -1.821,-3.382 -5.181,-5.099 -9.978,-5.099 -2.476,0 -6.217,0.517 -9.99,2.975 -0.315,0.205 -0.422,0.615 -0.25,0.949 l 0.861,1.67 c 0.098,0.189 0.271,0.326 0.478,0.375 0.059,0.014 0.116,0.021 0.173,0.021 0.151,0 0.3,-0.047 0.425,-0.136 2.313,-1.639 5.186,-2.504 8.305,-2.504 3.995,0 6.004,1.854 7,3.938 l 0,0 c 1.004,2.222 -0.562,4.404 -2.285,4.584 -0.085,0.006 -0.17,0.009 -0.254,0.014 -0.014,0 -0.028,10e-4 -0.042,0 -0.055,-10e-4 -0.102,0.003 -0.144,0.009 -10.978,0.626 -16.537,4.313 -16.537,10.979 0,2.027 0.803,4.058 2.201,5.57 1.233,1.332 3.561,2.92 7.636,2.92 3.471,0 6.271,-1.111 8.324,-2.472 0.062,-0.03 0.131,-0.075 0.212,-0.142 0.022,-0.016 0.042,-0.03 0.063,-0.047 0.128,-0.088 0.256,-0.178 0.378,-0.269 1.275,-0.825 1.969,-0.351 2.623,0.504 0.002,0.003 0.006,0.005 0.008,0.007 0.84,1.141 2.161,1.719 3.962,1.719 0.847,0 1.592,-0.094 2.345,-0.295 0.319,-0.084 0.543,-0.375 0.543,-0.707 l 0,-1.67 c -0.002,-0.21 -0.098,-0.415 -0.262,-0.555 z m -18.252,0.528 c -3.042,0 -6.11,-1.724 -6.11,-5.572 0,-4.862 5.936,-6.58 12.167,-7.043 2.319,-0.043 4.097,2.162 4.311,4.575 l 0,0.988 c -0.062,0.647 -0.246,1.289 -0.568,1.889 -0.161,0.263 -0.355,0.556 -0.589,0.863 -0.04,0.047 -0.074,0.094 -0.103,0.135 -1.443,1.847 -4.224,4.165 -9.108,4.165 z"
|
291
|
+
inkscape:connector-curvature="0"
|
292
|
+
style="fill:#030000" />
|
293
|
+
<path
|
294
|
+
id="path4622"
|
295
|
+
d="m 50.245,25.488 -2.047,0 c -0.393,0 -0.715,0.312 -0.731,0.703 -0.064,1.619 -0.892,1.836 -2.704,0.767 -0.01,-0.006 -0.018,-0.015 -0.025,-0.019 -0.179,-0.119 -0.361,-0.231 -0.545,-0.34 -0.012,-0.006 -0.021,-0.012 -0.032,-0.02 -0.088,-0.059 -0.169,-0.104 -0.245,-0.141 -1.982,-1.096 -4.306,-1.649 -6.923,-1.649 -3.739,0 -7.429,1.548 -10.122,4.25 -2.083,2.087 -4.564,5.826 -4.564,11.784 0,3.818 1.348,7.412 3.792,10.121 2.595,2.875 6.234,4.459 10.249,4.459 3.11,0 5.515,-0.819 7.334,-1.897 0.004,-0.002 0.008,-0.003 0.013,-0.005 1.952,-0.873 3.601,-2.182 3.135,2.232 -0.875,5.678 -4.52,8.765 -10.482,8.765 -4.175,0 -7.31,-1.403 -9.204,-2.583 -0.116,-0.072 -0.251,-0.109 -0.387,-0.109 -0.061,0 -0.122,0.008 -0.182,0.022 -0.193,0.049 -0.358,0.176 -0.456,0.351 l -0.969,1.725 c -0.189,0.336 -0.086,0.761 0.236,0.972 2.853,1.863 6.909,2.976 10.854,2.976 2.69,0 9.293,-0.625 12.494,-6.412 1.384,-2.481 2.029,-5.969 2.029,-10.969 l 0,-17.458 c 0,-2.474 0.07,-4.679 0.214,-6.738 0.015,-0.201 -0.057,-0.401 -0.194,-0.549 -0.141,-0.153 -0.335,-0.238 -0.538,-0.238 z M 33.353,51.517 C 32.749,51.277 25.745,48.3 26.34,39.705 c 0.551,-7.946 5.723,-10.459 6.519,-10.798 1.277,-0.5 2.699,-0.77 4.24,-0.77 1.664,0 3.112,0.327 4.354,0.873 6.846,3.871 7.696,16.453 0.885,21.467 -1.592,1 -3.437,1.574 -5.346,1.574 -1.342,10e-4 -2.553,-0.194 -3.639,-0.534 z"
|
296
|
+
inkscape:connector-curvature="0"
|
297
|
+
style="fill:#030000" />
|
298
|
+
<path
|
299
|
+
id="path4624"
|
300
|
+
d="m 208.092,25.488 -2.047,0 c -0.393,0 -0.716,0.312 -0.731,0.703 -0.065,1.619 -0.892,1.836 -2.702,0.767 -0.01,-0.005 -0.019,-0.015 -0.027,-0.019 -0.178,-0.119 -0.362,-0.231 -0.546,-0.34 -0.011,-0.008 -0.021,-0.014 -0.031,-0.02 -0.087,-0.059 -0.168,-0.104 -0.244,-0.139 -1.981,-1.098 -4.307,-1.651 -6.924,-1.651 -3.739,0 -7.429,1.548 -10.122,4.25 -2.082,2.087 -4.563,5.826 -4.563,11.784 0,3.818 1.346,7.412 3.792,10.121 2.595,2.875 6.233,4.459 10.248,4.459 3.11,0 5.514,-0.819 7.335,-1.897 0.004,-0.002 0.007,-0.003 0.012,-0.005 1.954,-0.874 3.603,-2.184 3.135,2.232 -0.875,5.679 -4.519,8.765 -10.481,8.765 -4.176,0 -7.311,-1.403 -9.204,-2.583 -0.118,-0.072 -0.251,-0.109 -0.388,-0.109 -0.06,0 -0.122,0.008 -0.182,0.022 -0.193,0.049 -0.358,0.176 -0.456,0.351 l -0.97,1.725 c -0.189,0.336 -0.085,0.761 0.236,0.972 2.854,1.863 6.91,2.976 10.854,2.976 2.688,0 9.293,-0.625 12.493,-6.412 1.385,-2.481 2.031,-5.969 2.031,-10.969 l 0,-17.458 c 0,-2.474 0.069,-4.679 0.214,-6.738 0.014,-0.201 -0.058,-0.401 -0.195,-0.549 -0.139,-0.153 -0.333,-0.238 -0.537,-0.238 z m -16.891,26.029 c -0.605,-0.24 -7.609,-3.217 -7.014,-11.812 0.552,-7.94 5.717,-10.455 6.518,-10.798 1.278,-0.5 2.701,-0.77 4.242,-0.77 1.665,0 3.112,0.327 4.354,0.873 6.845,3.871 7.696,16.453 0.884,21.467 -1.592,1 -3.436,1.574 -5.345,1.574 -1.343,10e-4 -2.553,-0.194 -3.639,-0.534 z"
|
301
|
+
inkscape:connector-curvature="0"
|
302
|
+
style="fill:#030000" />
|
303
|
+
<linearGradient
|
304
|
+
gradientTransform="matrix(1,0,0,-1,-279.2305,-111.2632)"
|
305
|
+
y2="-176.4133"
|
306
|
+
x2="390.90091"
|
307
|
+
y1="-115.3889"
|
308
|
+
x1="390.90091"
|
309
|
+
gradientUnits="userSpaceOnUse"
|
310
|
+
id="SVGID_1_">
|
311
|
+
<stop
|
312
|
+
id="stop4627"
|
313
|
+
style="stop-color:#5795C6"
|
314
|
+
offset="0" />
|
315
|
+
<stop
|
316
|
+
id="stop4629"
|
317
|
+
style="stop-color:#0B3F63"
|
318
|
+
offset="1" />
|
319
|
+
</linearGradient>
|
320
|
+
<path
|
321
|
+
id="path4631"
|
322
|
+
d="m 109.318,11.263 c -2.338,2.336 -4.109,5.342 -5.032,8.654 -6.076,-0.093 -12.171,2.273 -17.007,7.109 -8.143,8.142 -10.675,22.914 0.667,34.254 9.542,9.543 23.793,9.688 33.145,0.332 4.42,-4.424 7.236,-10.506 7.297,-16.939 3.14,-0.835 6.124,-2.507 8.669,-5.049 6.956,-6.959 9.086,-18.919 -0.311,-28.318 -7.832,-7.83 -19.625,-7.847 -27.428,-0.043 z m 25.621,20.422 c -1.335,1.338 -3.045,2.324 -4.932,2.864 -3.027,0.867 -4.656,0.777 -5.697,2.515 -1.041,1.735 -0.926,1.94 -0.881,5.195 0.057,3.688 -1.332,7.512 -4.813,10.994 -5.32,5.318 -15.14,6.504 -22.366,-0.721 -5.693,-5.694 -8.365,-15.278 -0.778,-22.865 2.816,-2.813 6.866,-4.477 11.124,-4.402 2.961,0.053 3.307,0.162 5.212,-0.703 1.909,-0.869 1.082,-2.799 2.223,-6.205 0.556,-1.66 1.544,-3.295 3.091,-4.844 4.127,-4.127 11.721,-5.072 17.285,0.49 4.534,4.535 6.456,11.76 0.532,17.682 z"
|
323
|
+
inkscape:connector-curvature="0"
|
324
|
+
style="fill:url(#SVGID_1_)" />
|
325
|
+
<path
|
326
|
+
id="path4633"
|
327
|
+
d="m 0.388,24.795 c -2.915,0 -5.501,0.671 -7.686,1.991 -0.526,0.318 -1.027,0.676 -1.5,1.068 -1.114,1.113 -2.128,2.432 -2.128,0.062 0,-0.817 -0.077,-1.722 -0.077,-1.722 -0.018,-0.39 -0.34,-0.697 -0.73,-0.697 l -2.156,0 c -0.201,0 -0.393,0.081 -0.531,0.227 -0.139,0.146 -0.211,0.343 -0.199,0.543 0.146,2.73 0.214,5.611 0.214,9.066 l 0,31.139 c 0,0.404 0.327,0.731 0.731,0.731 l 2.209,0 c 0.404,0 0.732,-0.327 0.732,-0.731 0,0 0,-9.742 0,-11.516 0,-1.774 0.603,-2.513 2.086,-1.485 2.325,1.61 5.169,2.581 8.389,2.581 4.086,0 7.805,-1.507 10.469,-4.242 2.863,-2.938 4.377,-7.089 4.377,-12.007 0,-4.005 -1.338,-7.725 -3.766,-10.471 C 8.196,26.365 4.589,24.795 0.388,24.795 Z m -0.647,27.961 c -4.727,0 -9.07,-3.237 -10.173,-7.206 -1.103,-3.969 -0.402,-7.971 0.204,-9.89 1.453,-4.598 5.514,-7.569 10.346,-7.569 7.088,0 10.797,5.946 10.797,11.821 0,7.923 -4.281,12.844 -11.174,12.844 z"
|
328
|
+
inkscape:connector-curvature="0"
|
329
|
+
style="fill:#040000" />
|
330
|
+
</g>
|
331
|
+
<path
|
332
|
+
style="fill:none;fill-rule:evenodd;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:1, 2;stroke-dashoffset:0;stroke-opacity:1;marker-end:url(#marker8735)"
|
333
|
+
d="m 188.13357,353.57357 -28.09798,0"
|
334
|
+
id="path4933"
|
335
|
+
inkscape:connector-curvature="0"
|
336
|
+
sodipodi:nodetypes="cc" />
|
337
|
+
<text
|
338
|
+
sodipodi:linespacing="125%"
|
339
|
+
id="text9291"
|
340
|
+
y="348.71756"
|
341
|
+
x="60.907589"
|
342
|
+
style="font-style:normal;font-weight:normal;font-size:20px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
343
|
+
xml:space="preserve"><tspan
|
344
|
+
id="tspan9295"
|
345
|
+
y="348.71756"
|
346
|
+
x="60.907589"
|
347
|
+
sodipodi:role="line">それ以外は</tspan><tspan
|
348
|
+
y="373.71756"
|
349
|
+
x="60.907589"
|
350
|
+
sodipodi:role="line"
|
351
|
+
id="tspan9299">他で処理</tspan></text>
|
352
|
+
</g>
|
353
|
+
</svg>
|
@@ -0,0 +1,506 @@
|
|
1
|
+
= Mroonga\n(('note:と'))\nPGroonga
|
2
|
+
|
3
|
+
: subtitle
|
4
|
+
Groongaを使って\nMySQLとPostgreSQLで日本語全文検索
|
5
|
+
: author
|
6
|
+
須藤功平
|
7
|
+
: institution
|
8
|
+
クリアコード
|
9
|
+
: content-source
|
10
|
+
MySQLとPostgreSQLと日本語全文検索
|
11
|
+
: date
|
12
|
+
2016-02-09
|
13
|
+
: allotted-time
|
14
|
+
25m
|
15
|
+
: theme
|
16
|
+
groonga
|
17
|
+
|
18
|
+
= Mroonga・PGroonga
|
19
|
+
|
20
|
+
* Mroonga(むるんが)
|
21
|
+
* (('wait'))MySQLに\n
|
22
|
+
高速日本語全文検索機能を追加する\n
|
23
|
+
プロダクト
|
24
|
+
* PGroonga(ぴーじーるんが)
|
25
|
+
* (('wait'))PostgreSQLに\n
|
26
|
+
高速日本語全文検索機能を追加する\n
|
27
|
+
プロダクト
|
28
|
+
|
29
|
+
= すごい!使いたい!
|
30
|
+
|
31
|
+
* (('wait'))インストールして!
|
32
|
+
* え。。。組み込みじゃないの。。。\n
|
33
|
+
(('note:(MariaDBにはMroongaは組み込まれています!)'))
|
34
|
+
* (('wait'))パッケージあるから簡単だよ!
|
35
|
+
* クラウドサービスで使えない。。。
|
36
|
+
* (('wait'))(('note:(クラウドサービスに入っていれば…!)'))
|
37
|
+
* (('note:HerokuのPostgreSQLにPGroonga入れて!とお願いだ!'))
|
38
|
+
|
39
|
+
= 使いたい!?
|
40
|
+
|
41
|
+
# blockquote
|
42
|
+
HerokuのPostgreSQLで\n
|
43
|
+
PGroongaを使えるなら\n
|
44
|
+
Herokuを使いたい!\n#herokujp
|
45
|
+
|
46
|
+
(('tag:center'))
|
47
|
+
↑と思うならtweet!\n
|
48
|
+
(Herokuの人が観測します。)
|
49
|
+
|
50
|
+
= 高速?
|
51
|
+
|
52
|
+
(('tag:center'))
|
53
|
+
ベンチマーク!
|
54
|
+
|
55
|
+
* 対象:Wikipedia日本語版
|
56
|
+
* レコード数:約185万件
|
57
|
+
* データサイズ:約7GB
|
58
|
+
* メモリー4GB・SSD250GB(('note:(ConoHa)'))
|
59
|
+
|
60
|
+
(('note:FYI https://github.com/groonga/wikipedia-search/issues/4'))
|
61
|
+
|
62
|
+
(('tag:center'))
|
63
|
+
(('note:(他人のベンチマークは参考程度)'))\n
|
64
|
+
(('note:(検討時はちゃんと実際の環境でベンチマークをとろう!)'))
|
65
|
+
|
66
|
+
= 速さ:検索1
|
67
|
+
|
68
|
+
(('tag:center'))
|
69
|
+
キーワード:テレビアニメ\n
|
70
|
+
(('note:(ヒット数:約2万3千件)'))
|
71
|
+
|
72
|
+
# RT
|
73
|
+
delimiter = [|]
|
74
|
+
|
75
|
+
InnoDB ngram | 3m2s
|
76
|
+
InnoDB MeCab | 6m20s
|
77
|
+
Mroonga:((*1*)) | 0.11s
|
78
|
+
pg_bigm | 4s
|
79
|
+
PGroonga:((*2*)) | 0.29s
|
80
|
+
|
81
|
+
= 速さ:検索2
|
82
|
+
|
83
|
+
(('tag:center'))
|
84
|
+
キーワード:データベース\n
|
85
|
+
(('note:(ヒット数:約1万7千件)'))
|
86
|
+
|
87
|
+
# RT
|
88
|
+
delimiter = [|]
|
89
|
+
|
90
|
+
InnoDB ngram | 36s
|
91
|
+
InnoDB MeCab:((*1*)) | 0.03s
|
92
|
+
Mroonga:((*2*)) | 0.09s
|
93
|
+
pg_bigm | 2s
|
94
|
+
PGroonga:((*3*)) | 0.17s
|
95
|
+
|
96
|
+
= 速さ:検索3
|
97
|
+
|
98
|
+
(('tag:center'))
|
99
|
+
キーワード:PostgreSQL OR MySQL\n
|
100
|
+
(('note:(ヒット数:約400件)'))
|
101
|
+
|
102
|
+
# RT
|
103
|
+
delimiter = [|]
|
104
|
+
|
105
|
+
InnoDB ngram | N/A(エラー)
|
106
|
+
InnoDB MeCab:((*1*)) | 0.005s
|
107
|
+
Mroonga:((*2*)) | 0.028s
|
108
|
+
pg_bigm | 0.185s
|
109
|
+
PGroonga:((*3*)) | 0.063s
|
110
|
+
|
111
|
+
= 速さ:検索4
|
112
|
+
|
113
|
+
(('tag:center'))
|
114
|
+
キーワード:日本\n
|
115
|
+
(('note:(ヒット数:約63万件)'))
|
116
|
+
|
117
|
+
# RT
|
118
|
+
delimiter = [|]
|
119
|
+
|
120
|
+
InnoDB ngram | 1.3s
|
121
|
+
InnoDB MeCab | 1.3s
|
122
|
+
Mroonga:((*1*)) | 0.21s
|
123
|
+
pg_bigm:((*2*)) | 0.84s
|
124
|
+
PGroonga | 1s
|
125
|
+
|
126
|
+
= 速さ:検索まとめ
|
127
|
+
|
128
|
+
* Mroonga・PGroonga
|
129
|
+
* (('wait'))安定して速い
|
130
|
+
* InnoDB FTS mecab・pg_bigm
|
131
|
+
* (('wait'))ハマれば速い
|
132
|
+
* InnoDB FTS ngram
|
133
|
+
* (('wait'))安定して遅い
|
134
|
+
|
135
|
+
= 使いたい!?
|
136
|
+
|
137
|
+
# blockquote
|
138
|
+
HerokuのPostgreSQLで\n
|
139
|
+
PGroongaを使えるなら\n
|
140
|
+
Herokuを使いたい!\n#herokujp
|
141
|
+
|
142
|
+
(('tag:center'))
|
143
|
+
↑と思うならtweet!\n
|
144
|
+
(Herokuの人が観測します。)
|
145
|
+
|
146
|
+
= 速さ:データロード
|
147
|
+
|
148
|
+
(('tag:center'))
|
149
|
+
約185万件・約7GB・SSD
|
150
|
+
|
151
|
+
# RT
|
152
|
+
delimiter = [|]
|
153
|
+
|
154
|
+
InnoDB ngram | 6m51s
|
155
|
+
InnoDB mecab | 6m22s
|
156
|
+
Mroonga:((*3*)) | 5m45s
|
157
|
+
pg_bigm:((*1*)) | 5m14s
|
158
|
+
PGroonga:((*2*)) | 5m22s
|
159
|
+
|
160
|
+
(('note:MySQLはbinlog有効、PostgreSQLはWAL有効'))\n
|
161
|
+
(('note:InnoDBはどっちも同じ処理'))\n
|
162
|
+
(('note:pg_bigmとPGroongaもどっちも同じ処理'))
|
163
|
+
|
164
|
+
= 速さ:インデックス作成
|
165
|
+
|
166
|
+
(('tag:center'))
|
167
|
+
約185万件・約7GB・SSD
|
168
|
+
|
169
|
+
# RT
|
170
|
+
delimiter = [|]
|
171
|
+
|
172
|
+
InnoDB ngram | 3h06m58s
|
173
|
+
InnoDB mecab | 2h41m55s
|
174
|
+
Mroonga:((*1*)) | 22m24s
|
175
|
+
pg_bigm | 3h43m23s
|
176
|
+
PGroonga:((*2*)) | 54m34s
|
177
|
+
|
178
|
+
(('note:MySQLはbinlog有効、PostgreSQLはWAL有効'))\n
|
179
|
+
(('note:バルクインデックス作成'))\n
|
180
|
+
(('note:=データ投入後インデックス作成'))
|
181
|
+
|
182
|
+
= 速さ:ロードまとめ
|
183
|
+
|
184
|
+
* (('wait'))データロードは大差ない
|
185
|
+
* (('wait'))インデックス作成は大差
|
186
|
+
* Mroonga・PGroongaは分単位
|
187
|
+
* InnoDB・pg_bigmは時間単位
|
188
|
+
|
189
|
+
= 使いたい!?
|
190
|
+
|
191
|
+
# blockquote
|
192
|
+
HerokuのPostgreSQLで\n
|
193
|
+
PGroongaを使えるなら\n
|
194
|
+
Herokuを使いたい!\n#herokujp
|
195
|
+
|
196
|
+
(('tag:center'))
|
197
|
+
↑と思うならtweet!\n
|
198
|
+
(Herokuの人が観測します。)
|
199
|
+
|
200
|
+
= サイズ:データ
|
201
|
+
|
202
|
+
# RT
|
203
|
+
delimiter = [|]
|
204
|
+
|
205
|
+
InnoDB ngram | 10GB
|
206
|
+
InnoDB mecab | 10GB
|
207
|
+
Mroonga | 8.2GB
|
208
|
+
pg_bigm:((*2*)) | 5.1GB
|
209
|
+
PGroonga:((*1*)) | 4.3GB
|
210
|
+
|
211
|
+
(('note:InnoDBはどっちも同じ'))\n
|
212
|
+
(('note:pg_bigmとPGroongaはどっちも同じはずだけど…'))
|
213
|
+
|
214
|
+
= サイズ:インデックス
|
215
|
+
|
216
|
+
# RT
|
217
|
+
delimiter = [|]
|
218
|
+
|
219
|
+
InnoDB ngram | 12GB
|
220
|
+
InnoDB mecab:((*1*)) | 6GB
|
221
|
+
Mroonga:((*1*)) | 6GB
|
222
|
+
pg_bigm:((*3*)) | 7GB
|
223
|
+
PGroonga | 10GB
|
224
|
+
|
225
|
+
(('note:InnoDBは一時ファイル(何10GB単位)を作る'))\n
|
226
|
+
(('note:PGroongaは元データ(8GB)のコピーもLZ4圧縮して持っている'))
|
227
|
+
|
228
|
+
= サイズ:まとめ
|
229
|
+
|
230
|
+
* データサイズ
|
231
|
+
* PostgreSQLは元データより小さめ
|
232
|
+
* InnoDBは元データより大きめ
|
233
|
+
* インデックスサイズ
|
234
|
+
* InnoDB mecabは小さめ\n
|
235
|
+
(('note:(ヒント:形態素解析ベースの方が小さくなる)'))
|
236
|
+
* Mroonga・pg_bigmはN-gramなのにInnoDB mecabと同じくらい
|
237
|
+
|
238
|
+
= 高速?
|
239
|
+
|
240
|
+
ベンチマークで\n
|
241
|
+
確認
|
242
|
+
|
243
|
+
= Mroonga・PGroonga
|
244
|
+
|
245
|
+
* Mroonga(むるんが)
|
246
|
+
* (('wait'))MySQLに\n
|
247
|
+
高速日本語全文検索機能を追加する\n
|
248
|
+
プロダクト
|
249
|
+
* PGroonga(ぴーじーるんが)
|
250
|
+
* (('wait'))PostgreSQLに\n
|
251
|
+
高速日本語全文検索機能を追加する\n
|
252
|
+
プロダクト
|
253
|
+
|
254
|
+
= 実現方法
|
255
|
+
|
256
|
+
* Mroonga(むるんが)
|
257
|
+
* (('wait'))MySQLに\n
|
258
|
+
((*Groonga(ぐるんが)*))を組み込み
|
259
|
+
* PGroonga(ぴーじーるんが)
|
260
|
+
* (('wait'))PostgreSQLに\n
|
261
|
+
((*Groonga(ぐるんが)*))を組み込み
|
262
|
+
|
263
|
+
= Groonga
|
264
|
+
|
265
|
+
* (('wait'))国産の高速全文検索エンジン
|
266
|
+
* 日本語バッチリ
|
267
|
+
* (('wait'))ライブラリーとして使える
|
268
|
+
* 組み込みやすい
|
269
|
+
* (('wait'))マルチスレッド対応\n
|
270
|
+
(('note:(MySQL組み込み時にうれしい)'))
|
271
|
+
* (('wait'))マルチプロセス対応\n
|
272
|
+
(('note:(PostgreSQL組み込み時にうれしい)'))
|
273
|
+
|
274
|
+
= 組み込み方針
|
275
|
+
|
276
|
+
* Groongaをできるだけ活かす
|
277
|
+
* 使い勝手はMySQL・PostgreSQLに寄せる
|
278
|
+
|
279
|
+
(('wait'))
|
280
|
+
(('tag:center'))
|
281
|
+
↓\n
|
282
|
+
SQLで使えるGroonga
|
283
|
+
|
284
|
+
= ポジション
|
285
|
+
|
286
|
+
# image
|
287
|
+
# src = images/position.svg
|
288
|
+
# relative_height = 100
|
289
|
+
|
290
|
+
= SQLで使えるGroonga
|
291
|
+
|
292
|
+
* Groongaのフル機能は諦める
|
293
|
+
* 速度など譲れない部分はがんばる
|
294
|
+
* その分、使いやすさを重視
|
295
|
+
* (('wait'))使いやすさ1=\n
|
296
|
+
MySQL・PostgreSQLとなじんでいる
|
297
|
+
* (('wait'))使いやすさ2=\n
|
298
|
+
MySQL・PostgreSQLの不便を解消
|
299
|
+
|
300
|
+
= なじみ度:Mroonga
|
301
|
+
|
302
|
+
(('tag:center'))
|
303
|
+
インデックス作成:MySQLと同じ
|
304
|
+
|
305
|
+
# coderay sql
|
306
|
+
CREATE TABLE ... (
|
307
|
+
...,
|
308
|
+
FULLTEXT INDEX (column)
|
309
|
+
) ENGINE=Mroonga;
|
310
|
+
|
311
|
+
= なじみ度:Mroonga
|
312
|
+
|
313
|
+
(('tag:center'))
|
314
|
+
全文検索:MySQLと同じ
|
315
|
+
|
316
|
+
# coderay sql
|
317
|
+
SELECT * FROM ...
|
318
|
+
WHERE
|
319
|
+
MATCH(column)
|
320
|
+
AGAINST('キーワード'
|
321
|
+
IN BOOLEAN MODE);
|
322
|
+
|
323
|
+
= 不便解消:Mroonga
|
324
|
+
|
325
|
+
(('tag:center'))
|
326
|
+
デフォルトOR→AND
|
327
|
+
|
328
|
+
# coderay sql
|
329
|
+
-- ↓AまたはBが含まれていればマッチ
|
330
|
+
AGAINST('A B' IN BOOLEAN MODE);
|
331
|
+
AGAINST('+A +B' IN BOOLEAN MODE);
|
332
|
+
-- ↑↓AとBが含まれていればマッチ
|
333
|
+
-- ↓Mroongaの拡張
|
334
|
+
AGAINST('*D+ A B' IN BOOLEAN MODE);
|
335
|
+
|
336
|
+
= 不便解消:Mroonga
|
337
|
+
|
338
|
+
(('tag:center'))
|
339
|
+
重み指定
|
340
|
+
|
341
|
+
# coderay sql
|
342
|
+
-- titleかcontentにAがあればマッチ
|
343
|
+
-- (便利。PostgreSQLではできない。)
|
344
|
+
MATCH(title, content)
|
345
|
+
AGAINST('A' IN BOOLEAN MODE)
|
346
|
+
-- でもtitleの方を重要視したい!
|
347
|
+
-- ↓Mroongaの拡張
|
348
|
+
AGAINST('*W1:10,2:1 A' IN BOOLEAN MODE)
|
349
|
+
|
350
|
+
= 不便解消:Mroonga
|
351
|
+
|
352
|
+
(('tag:center'))
|
353
|
+
全文検索+ORDER LIMIT高速化
|
354
|
+
|
355
|
+
# coderay sql
|
356
|
+
SELECT * FROM tweets
|
357
|
+
WHERE
|
358
|
+
MATCH(content)
|
359
|
+
AGAINST('...' IN BOOLEAN MODE)
|
360
|
+
ORDER BY timestamp DESC
|
361
|
+
LIMIT 10;
|
362
|
+
|
363
|
+
= ORDER LIMIT高速化
|
364
|
+
|
365
|
+
* なぜ速いか
|
366
|
+
* (('wait'))Groongaでソートし、LIMIT件だけMySQLに返しているから
|
367
|
+
* (('wait'))MySQLよりGroongaでやった方が速い\n
|
368
|
+
(('note:(ヒント:カラムストア)'))
|
369
|
+
|
370
|
+
= さらにORDER LIMIT高速化
|
371
|
+
|
372
|
+
# coderay sql
|
373
|
+
SELECT * FROM tweets
|
374
|
+
WHERE
|
375
|
+
MATCH(content)
|
376
|
+
AGAINST('...' IN BOOLEAN MODE) AND
|
377
|
+
timestamp >= '2016-02-01'
|
378
|
+
-- ↑今月の分だけ対象にしたい
|
379
|
+
ORDER BY timestamp DESC
|
380
|
+
LIMIT 10;
|
381
|
+
|
382
|
+
= さらにORDER LIMIT高速化
|
383
|
+
|
384
|
+
* なぜ速いか
|
385
|
+
* (('wait'))Groongaで((*絞り込んで*))ソートし、\n
|
386
|
+
LIMIT件だけMySQLに返しているから
|
387
|
+
* (('wait'))MySQLよりGroongaでやった方が速い\n
|
388
|
+
(('note:(ヒント:カラムストア)'))
|
389
|
+
* 場合によっては10倍以上高速化
|
390
|
+
* (('note:http://tech.gmo-media.jp/post/69542751128/mroonga-311-new-optimization'))
|
391
|
+
|
392
|
+
= PGroonga
|
393
|
+
|
394
|
+
* Groongaのフル機能は諦める
|
395
|
+
* 速度など譲れない部分はがんばる
|
396
|
+
* その分、使いやすさを重視
|
397
|
+
* 使いやすさ1=\n
|
398
|
+
MySQL・((*PostgreSQL*))となじんでいる
|
399
|
+
* 使いやすさ2=\n
|
400
|
+
MySQL・((*PostgreSQL*))の不便を解消
|
401
|
+
|
402
|
+
= なじみ度:PGroonga
|
403
|
+
|
404
|
+
(('tag:center'))
|
405
|
+
インデックス作成:\n
|
406
|
+
PostgreSQLと同じ
|
407
|
+
|
408
|
+
# coderay sql
|
409
|
+
CREATE INDEX name ON texts
|
410
|
+
USING pgroonga (content);
|
411
|
+
|
412
|
+
= なじみ度:PGroonga
|
413
|
+
|
414
|
+
(('tag:center'))
|
415
|
+
全文検索:\n
|
416
|
+
PostgreSQLのtextsearhとほぼ同じ
|
417
|
+
|
418
|
+
# coderay sql
|
419
|
+
SELECT * FROM ...
|
420
|
+
WHERE
|
421
|
+
column @@ 'キーワード';
|
422
|
+
|
423
|
+
= textsearchとの違い
|
424
|
+
|
425
|
+
(('tag:center'))
|
426
|
+
構文
|
427
|
+
|
428
|
+
# coderay sql
|
429
|
+
-- textsearch
|
430
|
+
-- プログラムのよう
|
431
|
+
'(A & B) | C'
|
432
|
+
-- PGroonga(不便解消)
|
433
|
+
-- Web検索エンジンのよう
|
434
|
+
'(A B) OR C'
|
435
|
+
|
436
|
+
= 不便解消:PGroonga
|
437
|
+
|
438
|
+
(('tag:center'))
|
439
|
+
Windows用バイナリーあり
|
440
|
+
|
441
|
+
* (('wait'))商用ログ管理製品\n
|
442
|
+
「VVAULT AUDIT」が採用\n
|
443
|
+
(('note:http://vvault.jp/product/vvault-audit/'))
|
444
|
+
* アクセスログに対して\n
|
445
|
+
ユーザー名・パスを全文検索
|
446
|
+
* (('wait'))決め手:高速・省スペース
|
447
|
+
|
448
|
+
= 不便解消:PGroonga
|
449
|
+
|
450
|
+
(('tag:center'))
|
451
|
+
JSONデータを全文検索
|
452
|
+
|
453
|
+
# coderay sql
|
454
|
+
CREATE TABLE logs (record jsonb);
|
455
|
+
CREATE INDEX i ON logs
|
456
|
+
USING pgroonga (record);
|
457
|
+
-- ログのどこかに「error」があればマッチ
|
458
|
+
SELECT * FROM logs
|
459
|
+
WHERE record @@ 'string @ "error"';
|
460
|
+
|
461
|
+
= JSON全文検索例
|
462
|
+
|
463
|
+
(('tag:center'))
|
464
|
+
以下は全部マッチ
|
465
|
+
|
466
|
+
# coderay json
|
467
|
+
{"message": "Error!"}
|
468
|
+
{"tags": ["web", "error"]}
|
469
|
+
{"syslog": {"message": "error!"}}
|
470
|
+
|
471
|
+
= 使いたい!?
|
472
|
+
|
473
|
+
# blockquote
|
474
|
+
HerokuのPostgreSQLで\n
|
475
|
+
PGroongaを使えるなら\n
|
476
|
+
Herokuを使いたい!\n#herokujp
|
477
|
+
|
478
|
+
(('tag:center'))
|
479
|
+
↑と思うならtweet!\n
|
480
|
+
(Herokuの人が観測します。)
|
481
|
+
|
482
|
+
= まとめ1
|
483
|
+
|
484
|
+
* Groonga(ぐるんが)
|
485
|
+
* (('wait'))国産の高速全文検索エンジン
|
486
|
+
* Mroonga(むるんが)
|
487
|
+
* (('wait'))MySQLからGroongaを使える!
|
488
|
+
* PGroonga(ぴーじーるんが)
|
489
|
+
* (('wait'))PostgreSQLからGroongaを使える!
|
490
|
+
|
491
|
+
= まとめ2
|
492
|
+
|
493
|
+
(('tag:center'))
|
494
|
+
実装方針
|
495
|
+
|
496
|
+
* (('wait'))Groongaをできるだけ活かす\n
|
497
|
+
(('note:(例:速度)'))
|
498
|
+
* (('wait'))MySQL/PostgreSQLっぽく使える
|
499
|
+
* (('wait'))MySQL/PostgreSQLをより便利に
|
500
|
+
|
501
|
+
= 次回予告
|
502
|
+
|
503
|
+
* (('wait'))トランザクションは?
|
504
|
+
* (('wait'))クラッシュしたら?
|
505
|
+
* (('wait'))レプリケーションは?
|
506
|
+
* (('wait'))もっと速くならないの?
|