File: table_create.html

package info (click to toggle)
groonga 11.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 121,576 kB
  • sloc: ansic: 801,209; javascript: 62,121; ruby: 46,206; cpp: 33,790; xml: 24,951; yacc: 13,333; sh: 7,776; python: 3,266; makefile: 2,315; perl: 133
file content (479 lines) | stat: -rw-r--r-- 37,245 bytes parent folder | download
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479


<!DOCTYPE html>

<html lang="en">
  <head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>7.3.62. table_create &#8212; Groonga v10.1.1-31-g1e46ba6 documentation</title>
    <link rel="stylesheet" href="../../_static/groonga.css" type="text/css" />
    <link rel="stylesheet" href="../../_static/pygments.css" type="text/css" />
    
    <script id="documentation_options" data-url_root="../../" src="../../_static/documentation_options.js"></script>
    <script src="../../_static/jquery.js"></script>
    <script src="../../_static/underscore.js"></script>
    <script src="../../_static/doctools.js"></script>
    <script src="../../_static/language_data.js"></script>
    
    <link rel="shortcut icon" href="../../_static/favicon.ico"/>
    <link rel="index" title="Index" href="../../genindex.html" />
    <link rel="search" title="Search" href="../../search.html" />
    <link rel="next" title="7.3.63. table_list" href="table_list.html" />
    <link rel="prev" title="7.3.61. table_copy" href="table_copy.html" /> 
  </head><body>
<div class="header">
  <h1 class="title">
    <a id="top-link" href="../../index.html">
      <span class="project">groonga</span>
      <span class="separator">-</span>
      <span class="description">An open-source fulltext search engine and column store.</span>
    </a>
  </h1>

  <div class="other-language-links">
    <ul>
      <li><a href="../../../../ja/html/reference/commands/table_create.html">日本語</a></li>
    </ul>
  </div>
</div>
  

    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             accesskey="I">index</a></li>
        <li class="right" >
          <a href="table_list.html" title="7.3.63. table_list"
             accesskey="N">next</a> |</li>
        <li class="right" >
          <a href="table_copy.html" title="7.3.61. table_copy"
             accesskey="P">previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">Groonga v10.1.1-31-g1e46ba6 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../../reference.html" ><span class="section-number">7. </span>Reference manual</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="../command.html" accesskey="U"><span class="section-number">7.3. </span>Command</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href=""><span class="section-number">7.3.62. </span><code class="docutils literal notranslate"><span class="pre">table_create</span></code></a></li> 
      </ul>
    </div>  

    <div class="document">
      <div class="documentwrapper">
        <div class="bodywrapper">
          <div class="body" role="main">
            
  <div class="section" id="table-create">
<h1><span class="section-number">7.3.62. </span><code class="docutils literal notranslate"><span class="pre">table_create</span></code><a class="headerlink" href="#table-create" title="Permalink to this headline">¶</a></h1>
<div class="section" id="summary">
<h2><span class="section-number">7.3.62.1. </span>Summary<a class="headerlink" href="#summary" title="Permalink to this headline">¶</a></h2>
<p><code class="docutils literal notranslate"><span class="pre">table_create</span></code> creates a new table in the current database. You need
to create one or more tables to store and search data.</p>
<p>See <a class="reference internal" href="../tables.html"><span class="doc">Tables</span></a> for table details.</p>
</div>
<div class="section" id="syntax">
<h2><span class="section-number">7.3.62.2. </span>Syntax<a class="headerlink" href="#syntax" title="Permalink to this headline">¶</a></h2>
<p>This command takes many parameters.</p>
<p>The required parameter is only <code class="docutils literal notranslate"><span class="pre">name</span></code> and otehrs are optional:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>table_create name
             [flags=TABLE_HASH_KEY]
             [key_type=null]
             [value_type=null]
             [default_tokenizer=null]
             [normalizer=null]
             [token_filters=null]
             [path=null]
</pre></div>
</div>
</div>
<div class="section" id="usage">
<h2><span class="section-number">7.3.62.3. </span>Usage<a class="headerlink" href="#usage" title="Permalink to this headline">¶</a></h2>
<p>This section describes about the followings:</p>
<blockquote>
<div><ul class="simple">
<li><p><a class="reference internal" href="#table-create-data-store"><span class="std std-ref">Create data store table</span></a></p></li>
<li><p><a class="reference internal" href="#table-create-large-data-store"><span class="std std-ref">Create large data store table</span></a></p></li>
<li><p><a class="reference internal" href="#table-create-lexicon"><span class="std std-ref">Create lexicon</span></a></p></li>
<li><p><a class="reference internal" href="#table-create-tag-index-table"><span class="std std-ref">Create tag index table</span></a></p></li>
<li><p><a class="reference internal" href="#table-create-range-index-table"><span class="std std-ref">Create range index table</span></a></p></li>
</ul>
</div></blockquote>
<div class="section" id="create-data-store-table">
<span id="table-create-data-store"></span><h3><span class="section-number">7.3.62.3.1. </span>Create data store table<a class="headerlink" href="#create-data-store-table" title="Permalink to this headline">¶</a></h3>
<p>You can use all table types for data store table. See
<a class="reference internal" href="../tables.html"><span class="doc">Tables</span></a> for all table types.</p>
<p>Table type is specified as <code class="docutils literal notranslate"><span class="pre">TABLE_${TYPE}</span></code> to <code class="docutils literal notranslate"><span class="pre">flags</span></code> parameter.</p>
<p>Here is an example to create <code class="docutils literal notranslate"><span class="pre">TABLE_NO_KEY</span></code> table:</p>
<p>Execution example:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>table_create Logs TABLE_NO_KEY
# [[0, 1337566253.89858, 0.000355720520019531], true]
</pre></div>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">table_create</span></code> command creates a table that is named <code class="docutils literal notranslate"><span class="pre">Logs</span></code>
and is <code class="docutils literal notranslate"><span class="pre">TABLE_NO_KEY</span></code> type.</p>
<p>If your records aren’t searched by key, <code class="docutils literal notranslate"><span class="pre">TABLE_NO_KEY</span></code> type table is
suitable. Because <code class="docutils literal notranslate"><span class="pre">TABLE_NO_KEY</span></code> doesn’t support key but it is fast
and small table. Storing logs into Groonga database is the case.</p>
<p>If your records are searched by key or referenced by one or more
columns, <code class="docutils literal notranslate"><span class="pre">TABLE_NO_KEY</span></code> type isn’t suitable. Lexicon for fulltext
search is the case.</p>
</div>
<div class="section" id="create-large-data-store-table">
<span id="table-create-large-data-store"></span><h3><span class="section-number">7.3.62.3.2. </span>Create large data store table<a class="headerlink" href="#create-large-data-store-table" title="Permalink to this headline">¶</a></h3>
<p>If you want to store many large keys, your table may not be able to
store them. If total key data is larger than 4GiB, you can’t store all
key data into your table by default.</p>
<p>You can expand the maximum total key size to 1TiB from 4GiB by
<code class="docutils literal notranslate"><span class="pre">KEY_LARGE</span></code> flag. <code class="docutils literal notranslate"><span class="pre">KEY_LARGE</span></code> flag can be used with only
<code class="docutils literal notranslate"><span class="pre">TABLE_HASH_KEY</span></code>. You can’t use <code class="docutils literal notranslate"><span class="pre">KEY_LARGE</span></code> flag with
<code class="docutils literal notranslate"><span class="pre">TABLE_NO_KEY</span></code>, <code class="docutils literal notranslate"><span class="pre">TABLE_PAT_KEY</span></code> nor <code class="docutils literal notranslate"><span class="pre">TABLE_DAT_KEY</span></code>.</p>
<p>Here is an example to create a table that can store many large keys:</p>
<p>Execution example:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>table_create Paths TABLE_HASH_KEY|KEY_LARGE ShortText
# [[0, 1337566253.89858, 0.000355720520019531], true]
</pre></div>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">table_create</span></code> command creates a table that is named <code class="docutils literal notranslate"><span class="pre">Paths</span></code>
and is <code class="docutils literal notranslate"><span class="pre">TABLE_HASH_KEY</span></code> type. The <code class="docutils literal notranslate"><span class="pre">Paths</span></code> table can store many
large keys.</p>
</div>
<div class="section" id="create-lexicon">
<span id="table-create-lexicon"></span><h3><span class="section-number">7.3.62.3.3. </span>Create lexicon<a class="headerlink" href="#create-lexicon" title="Permalink to this headline">¶</a></h3>
<p>You can use all table types except <code class="docutils literal notranslate"><span class="pre">TABLE_NO_KEY</span></code> for lexicon.
Lexicon needs key support but <code class="docutils literal notranslate"><span class="pre">TABLE_NO_KEY</span></code> doesn’t support key.</p>
<p>Here is an example to create <code class="docutils literal notranslate"><span class="pre">TABLE_PAT_KEY</span></code> table:</p>
<p>Execution example:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>table_create Lexicon TABLE_PAT_KEY ShortText --default_tokenizer TokenBigram --normalizer NormalizerAuto
# [[0, 1337566253.89858, 0.000355720520019531], true]
</pre></div>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">table_create</span></code> command creates the following table:</p>
<ul class="simple">
<li><p>The table is named <code class="docutils literal notranslate"><span class="pre">Lexicon</span></code>.</p></li>
<li><p>The table is <code class="docutils literal notranslate"><span class="pre">TABLE_PAT_KEY</span></code> type table.</p></li>
<li><p>The table’s key is <code class="docutils literal notranslate"><span class="pre">ShortText</span></code> type.</p></li>
<li><p>The table uses <code class="docutils literal notranslate"><span class="pre">TokenBigram</span></code> tokenizer to extract tokens from a
normalized text.</p></li>
<li><p>The table uses <code class="docutils literal notranslate"><span class="pre">NormalizerAuto</span></code> normalizer to normalize a text.</p></li>
</ul>
<p><code class="docutils literal notranslate"><span class="pre">TABLE_PAT_KEY</span></code> is suitable table type for lexicon. Lexicon is used
for fulltext search.</p>
<p>In fulltext search, predictive search may be used for fuzzy
search. Predictive search is supported by <code class="docutils literal notranslate"><span class="pre">TABLE_PAT_KEY</span></code> and
<code class="docutils literal notranslate"><span class="pre">TABLE_DAT_KEY</span></code>.</p>
<p>Lexicon has many keys because a fulltext target text has many
tokens. Table that has many keys should consider table size because
large table requires large memory. Requiring large memory causes disk
I/O. It blocks fast search. So table size is important for a table
that has many keys. <code class="docutils literal notranslate"><span class="pre">TABLE_PAT_KEY</span></code> is less table size than
<code class="docutils literal notranslate"><span class="pre">TABLE_DAT_KEY</span></code>.</p>
<p>Because of the above reasons, <code class="docutils literal notranslate"><span class="pre">TABLE_PAT_KEY</span></code> is suitable table type
for lexicon.</p>
</div>
<div class="section" id="create-tag-index-table">
<span id="table-create-tag-index-table"></span><h3><span class="section-number">7.3.62.3.4. </span>Create tag index table<a class="headerlink" href="#create-tag-index-table" title="Permalink to this headline">¶</a></h3>
<p>You can use all table types except <code class="docutils literal notranslate"><span class="pre">TABLE_NO_KEY</span></code> for tag index
table. Tag index table needs key support but <code class="docutils literal notranslate"><span class="pre">TABLE_NO_KEY</span></code> doesn’t
support key.</p>
<p>Here is an example to create <code class="docutils literal notranslate"><span class="pre">TABLE_HASH_KEY</span></code> table:</p>
<p>Execution example:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>table_create Tags TABLE_HASH_KEY ShortText
# [[0, 1337566253.89858, 0.000355720520019531], true]
</pre></div>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">table_create</span></code> command creates a table that is named <code class="docutils literal notranslate"><span class="pre">Tags</span></code>,
is <code class="docutils literal notranslate"><span class="pre">TABLE_HASH_KEY</span></code> type and has <code class="docutils literal notranslate"><span class="pre">ShortText</span></code> type key.</p>
<p><code class="docutils literal notranslate"><span class="pre">TABLE_HASH_KEY</span></code> or <code class="docutils literal notranslate"><span class="pre">TABLE_DAT_KEY</span></code> are suitable table types for
tag index table.</p>
<p>If you need only exact match tag search feature, <code class="docutils literal notranslate"><span class="pre">TABLE_HASH_KEY</span></code> is
suitable. It is the common case.</p>
<p>If you also need predictive tag search feature (for example, searching
<code class="docutils literal notranslate"><span class="pre">&quot;groonga&quot;</span></code> by <code class="docutils literal notranslate"><span class="pre">&quot;gr&quot;</span></code> keyword.), <code class="docutils literal notranslate"><span class="pre">TABLE_DAT_KEY</span></code> is suitable.
<code class="docutils literal notranslate"><span class="pre">TABLE_DAT_KEY</span></code> is large table size but it is not important because
the number of tags will not be large.</p>
</div>
<div class="section" id="create-range-index-table">
<span id="table-create-range-index-table"></span><h3><span class="section-number">7.3.62.3.5. </span>Create range index table<a class="headerlink" href="#create-range-index-table" title="Permalink to this headline">¶</a></h3>
<p>You can use <code class="docutils literal notranslate"><span class="pre">TABLE_PAT_KEY</span></code> and <code class="docutils literal notranslate"><span class="pre">TABLE_DAT_KEY</span></code> table types for
range index table. Range index table needs range search support but
<code class="docutils literal notranslate"><span class="pre">TABLE_NO_KEY</span></code> and <code class="docutils literal notranslate"><span class="pre">TABLE_HASH_KEY</span></code> don’t support it.</p>
<p>Here is an example to create <code class="docutils literal notranslate"><span class="pre">TABLE_DAT_KEY</span></code> table:</p>
<p>Execution example:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>table_create Ages TABLE_DAT_KEY UInt32
# [[0, 1337566253.89858, 0.000355720520019531], true]
</pre></div>
</div>
<p>The <code class="docutils literal notranslate"><span class="pre">table_create</span></code> command creates a table that is named <code class="docutils literal notranslate"><span class="pre">Ages</span></code>,
is <code class="docutils literal notranslate"><span class="pre">TABLE_DAT_KEY</span></code> type and has <code class="docutils literal notranslate"><span class="pre">UInt32</span></code> type key.</p>
<p><code class="docutils literal notranslate"><span class="pre">TABLE_PAT_KEY</span></code> and <code class="docutils literal notranslate"><span class="pre">TABLE_DAT_KEY</span></code> are suitable table types for
range index table.</p>
<p>If you don’t have many indexed items, <code class="docutils literal notranslate"><span class="pre">TABLE_DAT_KEY</span></code> is
suitable. Index for age is the case in the above example. Index for
age will have only 0-100 items because human doesn’t live so long.</p>
<p>If you have many indexed items, <code class="docutils literal notranslate"><span class="pre">TABLE_PAT_KEY</span></code> is suitable. Because
<code class="docutils literal notranslate"><span class="pre">TABLE_PAT_KEY</span></code> is smaller than <code class="docutils literal notranslate"><span class="pre">TABLE_DAT_KEY</span></code>.</p>
</div>
</div>
<div class="section" id="parameters">
<h2><span class="section-number">7.3.62.4. </span>Parameters<a class="headerlink" href="#parameters" title="Permalink to this headline">¶</a></h2>
<p>This section describes all parameters.</p>
<div class="section" id="required-parameters">
<h3><span class="section-number">7.3.62.4.1. </span>Required parameters<a class="headerlink" href="#required-parameters" title="Permalink to this headline">¶</a></h3>
<p>There is only one required parameter.</p>
<div class="section" id="name">
<span id="table-create-name"></span><h4><span class="section-number">7.3.62.4.1.1. </span><code class="docutils literal notranslate"><span class="pre">name</span></code><a class="headerlink" href="#name" title="Permalink to this headline">¶</a></h4>
<p>Specifies a table name to be created. <code class="docutils literal notranslate"><span class="pre">name</span></code> must be specified.</p>
<p>Here are available characters:</p>
<ul class="simple">
<li><p><code class="docutils literal notranslate"><span class="pre">0</span></code> .. <code class="docutils literal notranslate"><span class="pre">9</span></code> (digit)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">a</span></code> .. <code class="docutils literal notranslate"><span class="pre">z</span></code> (alphabet, lower case)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">A</span></code> .. <code class="docutils literal notranslate"><span class="pre">Z</span></code> (alphabet, upper case)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">#</span></code> (hash)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">&#64;</span></code> (at mark)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">-</span></code> (hyphen)</p></li>
<li><p><code class="docutils literal notranslate"><span class="pre">_</span></code> (underscore) (NOTE: Underscore can’t be used as the first
character.)</p></li>
</ul>
<p>You need to create a name with one or more the above characters. Note
that you can’t use <code class="docutils literal notranslate"><span class="pre">_</span></code> as the first character such as <code class="docutils literal notranslate"><span class="pre">_name</span></code>.</p>
</div>
</div>
<div class="section" id="optional-parameters">
<h3><span class="section-number">7.3.62.4.2. </span>Optional parameters<a class="headerlink" href="#optional-parameters" title="Permalink to this headline">¶</a></h3>
<p>There are some optional parameters.</p>
<div class="section" id="flags">
<span id="table-create-flags"></span><h4><span class="section-number">7.3.62.4.2.1. </span><code class="docutils literal notranslate"><span class="pre">flags</span></code><a class="headerlink" href="#flags" title="Permalink to this headline">¶</a></h4>
<p>Specifies a table type and table customize options.</p>
<p>Here are available flags:</p>
<table class="docutils align-default">
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<thead>
<tr class="row-odd"><th class="head"><p>Flag</p></th>
<th class="head"><p>Description</p></th>
</tr>
</thead>
<tbody>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">TABLE_NO_KEY</span></code></p></td>
<td><p>Array table. See also <a class="reference internal" href="../tables.html#table-no-key"><span class="std std-ref">TABLE_NO_KEY</span></a>.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">TABLE_HASH_KEY</span></code></p></td>
<td><p>Hash table. See also <a class="reference internal" href="../tables.html#table-hash-key"><span class="std std-ref">TABLE_HASH_KEY</span></a>.</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">TABLE_PAT_KEY</span></code></p></td>
<td><p>Patricia trie. See also <a class="reference internal" href="../tables.html#table-pat-key"><span class="std std-ref">TABLE_PAT_KEY</span></a>.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">TABLE_DAT_KEY</span></code></p></td>
<td><p>Double array trie. See also <a class="reference internal" href="../tables.html#table-dat-key"><span class="std std-ref">TABLE_DAT_KEY</span></a>.</p></td>
</tr>
<tr class="row-even"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_WITH_SIS</span></code></p></td>
<td><p>Enable Semi Infinite String. Require <code class="docutils literal notranslate"><span class="pre">TABLE_PAT_KEY</span></code>.</p></td>
</tr>
<tr class="row-odd"><td><p><code class="docutils literal notranslate"><span class="pre">KEY_LARGE</span></code></p></td>
<td><p>Expand the maximum total key size to 1TiB from 4GiB. Require
<code class="docutils literal notranslate"><span class="pre">TABLE_HASH_KEY</span></code>.</p></td>
</tr>
</tbody>
</table>
<div class="admonition note">
<p class="admonition-title">Note</p>
<p>Since Groonga 2.1.0 <code class="docutils literal notranslate"><span class="pre">KEY_NORMALIZE</span></code> flag is deprecated. Use
<code class="docutils literal notranslate"><span class="pre">normalizer</span></code> option with <code class="docutils literal notranslate"><span class="pre">NormalizerAuto</span></code> instead.</p>
</div>
<p>You must specify one of <code class="docutils literal notranslate"><span class="pre">TABLE_${TYPE}</span></code> flags. You can’t specify two
or more <code class="docutils literal notranslate"><span class="pre">TABLE_${TYPE}</span></code> flags. For example,
<code class="docutils literal notranslate"><span class="pre">TABLE_NO_KEY|TABLE_HASH_KEY</span></code> is invalid.</p>
<p>You can combine flags with <code class="docutils literal notranslate"><span class="pre">|</span></code> (vertical bar) such as
<code class="docutils literal notranslate"><span class="pre">TABLE_PAT_KEY|KEY_WITH_SIS</span></code>.</p>
<p>See <a class="reference internal" href="../tables.html"><span class="doc">Tables</span></a> for difference between table types.</p>
<p>The default flags are <code class="docutils literal notranslate"><span class="pre">TABLE_HASH_KEY</span></code>.</p>
</div>
<div class="section" id="key-type">
<span id="table-create-key-type"></span><h4><span class="section-number">7.3.62.4.2.2. </span><code class="docutils literal notranslate"><span class="pre">key_type</span></code><a class="headerlink" href="#key-type" title="Permalink to this headline">¶</a></h4>
<p>Specifies key type.</p>
<p>If you specify <code class="docutils literal notranslate"><span class="pre">TABLE_HASH_KEY</span></code>, <code class="docutils literal notranslate"><span class="pre">TABLE_PAT_KEY</span></code> or
<code class="docutils literal notranslate"><span class="pre">TABLE_DAT_KEY</span></code> as <code class="docutils literal notranslate"><span class="pre">flags</span></code> parameter, you need to specify
<code class="docutils literal notranslate"><span class="pre">key_type</span></code> option.</p>
<p>See <a class="reference internal" href="../types.html"><span class="doc">Data types</span></a> for all types.</p>
<p>The default value is none.</p>
</div>
<div class="section" id="value-type">
<span id="table-create-value-type"></span><h4><span class="section-number">7.3.62.4.2.3. </span><code class="docutils literal notranslate"><span class="pre">value_type</span></code><a class="headerlink" href="#value-type" title="Permalink to this headline">¶</a></h4>
<p>Specifies value type.</p>
<p>You can use value when you specify <code class="docutils literal notranslate"><span class="pre">TABLE_NO_KEY</span></code>,
<code class="docutils literal notranslate"><span class="pre">TABLE_HASH_KEY</span></code> or <code class="docutils literal notranslate"><span class="pre">TABLE_PAT_KEY</span></code> as <code class="docutils literal notranslate"><span class="pre">flags</span></code> parameter. Value
type must be a fixed size type. For example, <code class="docutils literal notranslate"><span class="pre">UInt32</span></code> can be used
but <code class="docutils literal notranslate"><span class="pre">ShortText</span></code> cannot be used. Use columns instead of value.</p>
<p>The default value is none.</p>
</div>
<div class="section" id="default-tokenizer">
<span id="table-create-default-tokenizer"></span><h4><span class="section-number">7.3.62.4.2.4. </span><code class="docutils literal notranslate"><span class="pre">default_tokenizer</span></code><a class="headerlink" href="#default-tokenizer" title="Permalink to this headline">¶</a></h4>
<p>Specifies the default tokenizer that is used on searching and data
loading.</p>
<p>You must specify <code class="docutils literal notranslate"><span class="pre">default_tokenizer</span></code> for a table that is used for
lexicon of fulltext search index. See <a class="reference internal" href="../tokenizers.html"><span class="doc">Tokenizers</span></a> for
available tokenizers. You must choose a tokenizer from the list for
fulltext search.</p>
<p>You don’t need to specify <code class="docutils literal notranslate"><span class="pre">default_tokenizer</span></code> in the following
cases:</p>
<blockquote>
<div><ul>
<li><p>You don’t use the table as a lexicon.</p></li>
<li><p>You use the table as a lexicon but you don’t need fulltext
search. For example:</p>
<blockquote>
<div><ul class="simple">
<li><p>Index target data isn’t text data such as <code class="docutils literal notranslate"><span class="pre">Int32</span></code> and <code class="docutils literal notranslate"><span class="pre">Time</span></code>.</p></li>
<li><p>You just need exact match search, prefix search and so on.</p></li>
</ul>
</div></blockquote>
</li>
</ul>
</div></blockquote>
<p>You can’t use <code class="docutils literal notranslate"><span class="pre">default_tokenizer</span></code> with <code class="docutils literal notranslate"><span class="pre">TABLE_NO_KEY</span></code> flag because
a table that uses <code class="docutils literal notranslate"><span class="pre">TABLE_NO_KEY</span></code> flag can’t be used as lexicon.</p>
<p>You must specify <code class="docutils literal notranslate"><span class="pre">TABLE_HASH_KEY</span></code>, <code class="docutils literal notranslate"><span class="pre">TABLE_PAT_KEY</span></code>,
<code class="docutils literal notranslate"><span class="pre">TABLE_DAT_KEY</span></code> to <a class="reference internal" href="#table-create-flags"><span class="std std-ref">flags</span></a> when you want to use
the table as a lexicon.</p>
<p>The default value is none.</p>
</div>
<div class="section" id="normalizer">
<span id="table-create-normalizer"></span><h4><span class="section-number">7.3.62.4.2.5. </span><code class="docutils literal notranslate"><span class="pre">normalizer</span></code><a class="headerlink" href="#normalizer" title="Permalink to this headline">¶</a></h4>
<p>Specifies a normalizer that is used to normalize key.</p>
<p>You cannot use <code class="docutils literal notranslate"><span class="pre">normalizer</span></code> with <code class="docutils literal notranslate"><span class="pre">TABLE_NO_KEY</span></code> because
<code class="docutils literal notranslate"><span class="pre">TABLE_NO_KEY</span></code> doesn’t support key.</p>
<p>See <a class="reference internal" href="../normalizers.html"><span class="doc">Normalizers</span></a> for all normalizsers.</p>
<p>The default value is none.</p>
</div>
<div class="section" id="token-filters">
<span id="table-create-token-filters"></span><h4><span class="section-number">7.3.62.4.2.6. </span><code class="docutils literal notranslate"><span class="pre">token_filters</span></code><a class="headerlink" href="#token-filters" title="Permalink to this headline">¶</a></h4>
<p>Specifies token filters separated by <code class="docutils literal notranslate"><span class="pre">,</span></code>.
Token filters are used to process tokens.</p>
<p>You cannot use <code class="docutils literal notranslate"><span class="pre">token_filters</span></code> with <code class="docutils literal notranslate"><span class="pre">TABLE_NO_KEY</span></code> because
<code class="docutils literal notranslate"><span class="pre">TABLE_NO_KEY</span></code> doesn’t support key.</p>
<p>See <a class="reference internal" href="../token_filters.html"><span class="doc">Token filters</span></a> for all token filters.</p>
<p>The default value is none.</p>
</div>
<div class="section" id="path">
<h4><span class="section-number">7.3.62.4.2.7. </span><code class="docutils literal notranslate"><span class="pre">path</span></code><a class="headerlink" href="#path" title="Permalink to this headline">¶</a></h4>
<div class="versionadded">
<p><span class="versionmodified added">New in version 10.0.7.</span></p>
</div>
<p>Specifies a path for storing a table.</p>
<p>This option is useful if you want to store a table that you often use to fast
storage (e.g. SSD) and store it that you don’t often use to slow storage (e.g. HDD).</p>
<p>You can use a relative path or an absolute path in this option.
If you specify a relative path, it is resolved from the current directory for the <code class="docutils literal notranslate"><span class="pre">groonga</span></code> process.</p>
<p>The default value is none.</p>
</div>
</div>
</div>
<div class="section" id="return-value">
<h2><span class="section-number">7.3.62.5. </span>Return value<a class="headerlink" href="#return-value" title="Permalink to this headline">¶</a></h2>
<p><code class="docutils literal notranslate"><span class="pre">table_create</span></code> returns <code class="docutils literal notranslate"><span class="pre">true</span></code> as body on success such as:</p>
<div class="highlight-none notranslate"><div class="highlight"><pre><span></span>[HEADER, true]
</pre></div>
</div>
<p>If <code class="docutils literal notranslate"><span class="pre">table_create</span></code> fails, error details are in <code class="docutils literal notranslate"><span class="pre">HEADER</span></code>.</p>
<p>See <a class="reference internal" href="../command/output_format.html"><span class="doc">Output format</span></a> for <code class="docutils literal notranslate"><span class="pre">HEADER</span></code>.</p>
</div>
<div class="section" id="see-also">
<h2><span class="section-number">7.3.62.6. </span>See also<a class="headerlink" href="#see-also" title="Permalink to this headline">¶</a></h2>
<ul class="simple">
<li><p><a class="reference internal" href="../tables.html"><span class="doc">Tables</span></a></p></li>
<li><p><a class="reference internal" href="column_create.html"><span class="doc">column_create</span></a></p></li>
<li><p><a class="reference internal" href="../tokenizers.html"><span class="doc">Tokenizers</span></a></p></li>
<li><p><a class="reference internal" href="../normalizers.html"><span class="doc">Normalizers</span></a></p></li>
<li><p><a class="reference internal" href="../command/output_format.html"><span class="doc">Output format</span></a></p></li>
</ul>
</div>
</div>


            <div class="clearer"></div>
          </div>
        </div>
      </div>
      <div class="sphinxsidebar" role="navigation" aria-label="main navigation">
        <div class="sphinxsidebarwrapper">
  <h3><a href="../../index.html">Table of Contents</a></h3>
  <ul>
<li><a class="reference internal" href="#">7.3.62. <code class="docutils literal notranslate"><span class="pre">table_create</span></code></a><ul>
<li><a class="reference internal" href="#summary">7.3.62.1. Summary</a></li>
<li><a class="reference internal" href="#syntax">7.3.62.2. Syntax</a></li>
<li><a class="reference internal" href="#usage">7.3.62.3. Usage</a><ul>
<li><a class="reference internal" href="#create-data-store-table">7.3.62.3.1. Create data store table</a></li>
<li><a class="reference internal" href="#create-large-data-store-table">7.3.62.3.2. Create large data store table</a></li>
<li><a class="reference internal" href="#create-lexicon">7.3.62.3.3. Create lexicon</a></li>
<li><a class="reference internal" href="#create-tag-index-table">7.3.62.3.4. Create tag index table</a></li>
<li><a class="reference internal" href="#create-range-index-table">7.3.62.3.5. Create range index table</a></li>
</ul>
</li>
<li><a class="reference internal" href="#parameters">7.3.62.4. Parameters</a><ul>
<li><a class="reference internal" href="#required-parameters">7.3.62.4.1. Required parameters</a><ul>
<li><a class="reference internal" href="#name">7.3.62.4.1.1. <code class="docutils literal notranslate"><span class="pre">name</span></code></a></li>
</ul>
</li>
<li><a class="reference internal" href="#optional-parameters">7.3.62.4.2. Optional parameters</a><ul>
<li><a class="reference internal" href="#flags">7.3.62.4.2.1. <code class="docutils literal notranslate"><span class="pre">flags</span></code></a></li>
<li><a class="reference internal" href="#key-type">7.3.62.4.2.2. <code class="docutils literal notranslate"><span class="pre">key_type</span></code></a></li>
<li><a class="reference internal" href="#value-type">7.3.62.4.2.3. <code class="docutils literal notranslate"><span class="pre">value_type</span></code></a></li>
<li><a class="reference internal" href="#default-tokenizer">7.3.62.4.2.4. <code class="docutils literal notranslate"><span class="pre">default_tokenizer</span></code></a></li>
<li><a class="reference internal" href="#normalizer">7.3.62.4.2.5. <code class="docutils literal notranslate"><span class="pre">normalizer</span></code></a></li>
<li><a class="reference internal" href="#token-filters">7.3.62.4.2.6. <code class="docutils literal notranslate"><span class="pre">token_filters</span></code></a></li>
<li><a class="reference internal" href="#path">7.3.62.4.2.7. <code class="docutils literal notranslate"><span class="pre">path</span></code></a></li>
</ul>
</li>
</ul>
</li>
<li><a class="reference internal" href="#return-value">7.3.62.5. Return value</a></li>
<li><a class="reference internal" href="#see-also">7.3.62.6. See also</a></li>
</ul>
</li>
</ul>

  <h4>Previous topic</h4>
  <p class="topless"><a href="table_copy.html"
                        title="previous chapter"><span class="section-number">7.3.61. </span><code class="docutils literal notranslate"><span class="pre">table_copy</span></code></a></p>
  <h4>Next topic</h4>
  <p class="topless"><a href="table_list.html"
                        title="next chapter"><span class="section-number">7.3.63. </span><code class="docutils literal notranslate"><span class="pre">table_list</span></code></a></p>
<div id="searchbox" style="display: none" role="search">
  <h3 id="searchlabel">Quick search</h3>
    <div class="searchformwrapper">
    <form class="search" action="../../search.html" method="get">
      <input type="text" name="q" aria-labelledby="searchlabel" />
      <input type="submit" value="Go" />
    </form>
    </div>
</div>
<script>$('#searchbox').show(0);</script>
        </div>
      </div>
      <div class="clearer"></div>
    </div>
    <div class="related" role="navigation" aria-label="related navigation">
      <h3>Navigation</h3>
      <ul>
        <li class="right" style="margin-right: 10px">
          <a href="../../genindex.html" title="General Index"
             >index</a></li>
        <li class="right" >
          <a href="table_list.html" title="7.3.63. table_list"
             >next</a> |</li>
        <li class="right" >
          <a href="table_copy.html" title="7.3.61. table_copy"
             >previous</a> |</li>
        <li class="nav-item nav-item-0"><a href="../../index.html">Groonga v10.1.1-31-g1e46ba6 documentation</a> &#187;</li>
          <li class="nav-item nav-item-1"><a href="../../reference.html" ><span class="section-number">7. </span>Reference manual</a> &#187;</li>
          <li class="nav-item nav-item-2"><a href="../command.html" ><span class="section-number">7.3. </span>Command</a> &#187;</li>
        <li class="nav-item nav-item-this"><a href=""><span class="section-number">7.3.62. </span><code class="docutils literal notranslate"><span class="pre">table_create</span></code></a></li> 
      </ul>
    </div>
    <div class="footer" role="contentinfo">
        &#169; Copyright 2009-2021, Brazil, Inc.
    </div>
  </body>
</html>