<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>8.5. Tables — groonga v3.0.5 documentation</title> <link rel="stylesheet" href="../_static/groonga.css" type="text/css" /> <link rel="stylesheet" href="../_static/pygments.css" type="text/css" /> <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: '../', VERSION: '3.0.5', COLLAPSE_INDEX: false, FILE_SUFFIX: '.html', HAS_SOURCE: true }; </script> <script type="text/javascript" src="../_static/jquery.js"></script> <script type="text/javascript" src="../_static/underscore.js"></script> <script type="text/javascript" src="../_static/doctools.js"></script> <link rel="shortcut icon" href="../_static/favicon.ico"/> <link rel="top" title="groonga v3.0.5 documentation" href="../index.html" /> <link rel="up" title="8. リファレンスマニュアル" href="../reference.html" /> <link rel="next" title="8.6. Normalizers" href="normalizers.html" /> <link rel="prev" title="8.4. データ型" href="types.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/tables.html"><img src="../_static/jp.png" alt="日本語">日本語版はこちら</a></li> </ul> </div> </div> <div class="related"> <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="normalizers.html" title="8.6. Normalizers" accesskey="N">next</a> |</li> <li class="right" > <a href="types.html" title="8.4. データ型" accesskey="P">previous</a> |</li> <li><a href="../index.html">groonga v3.0.5 documentation</a> »</li> <li><a href="../reference.html" accesskey="U">8. リファレンスマニュアル</a> »</li> </ul> </div> <div class="document"> <div class="documentwrapper"> <div class="bodywrapper"> <div class="body"> <div class="section" id="tables"> <h1>8.5. Tables<a class="headerlink" href="#tables" title="Permalink to this headline">¶</a></h1> <div class="section" id="summary"> <h2>8.5.1. Summary<a class="headerlink" href="#summary" title="Permalink to this headline">¶</a></h2> <p>Table in groonga manages relation between ID and key. Groonga provides four table types. They are <tt class="docutils literal"><span class="pre">TABLE_NO_KEY</span></tt>, <tt class="docutils literal"><span class="pre">TABLE_HASH_KEY</span></tt>, <tt class="docutils literal"><span class="pre">TABLE_PAT_KEY</span></tt> and <tt class="docutils literal"><span class="pre">TABLE_DAT_KEY</span></tt>.</p> <p>All tables except <tt class="docutils literal"><span class="pre">TABLE_NO_KEY</span></tt> provides both fast ID search by key and fast key search by ID. <tt class="docutils literal"><span class="pre">TABLE_NO_KEY</span></tt> doesn't support key. <tt class="docutils literal"><span class="pre">TABLE_NO_KEY</span></tt> only manages ID. So <tt class="docutils literal"><span class="pre">TABLE_NO_KEY</span></tt> doesn't provides ID search and key search.</p> </div> <div class="section" id="characteristics"> <h2>8.5.2. Characteristics<a class="headerlink" href="#characteristics" title="Permalink to this headline">¶</a></h2> <p>Here is a chracteristic table of all tables in groonga. (<tt class="docutils literal"><span class="pre">TABLE_</span></tt> prefix is omitted in the table.)</p> <table border="1" class="docutils"> <colgroup> <col width="21%" /> <col width="18%" /> <col width="21%" /> <col width="20%" /> <col width="20%" /> </colgroup> <thead valign="bottom"> <tr class="row-odd"><th class="head"> </th> <th class="head"><tt class="docutils literal"><span class="pre">NO_KEY</span></tt></th> <th class="head"><tt class="docutils literal"><span class="pre">HASH_KEY</span></tt></th> <th class="head"><tt class="docutils literal"><span class="pre">PAT_KEY</span></tt></th> <th class="head"><tt class="docutils literal"><span class="pre">DAT_KEY</span></tt></th> </tr> </thead> <tbody valign="top"> <tr class="row-even"><td>Data structure</td> <td>Array</td> <td>Hash table</td> <td>Patricia trie</td> <td>Double array trie</td> </tr> <tr class="row-odd"><td>ID support</td> <td>o</td> <td>o</td> <td>o</td> <td>o</td> </tr> <tr class="row-even"><td>Key support</td> <td>x</td> <td>o</td> <td>o</td> <td>o</td> </tr> <tr class="row-odd"><td>Value support</td> <td>o</td> <td>o</td> <td>o</td> <td>x</td> </tr> <tr class="row-even"><td><p class="first">Key -> ID speed</p> <ul class="last simple"> <li>o: fast</li> <li>x: slow</li> </ul> </td> <td>-</td> <td>oo</td> <td>x</td> <td>o</td> </tr> <tr class="row-odd"><td><p class="first">Update speed</p> <ul class="last simple"> <li>o: fast</li> <li>x: slow</li> </ul> </td> <td>ooo</td> <td>o</td> <td>o</td> <td>x</td> </tr> <tr class="row-even"><td><p class="first">Size</p> <ul class="last simple"> <li>o: small</li> <li>x: large</li> </ul> </td> <td>ooo</td> <td>o</td> <td>oo</td> <td>x</td> </tr> <tr class="row-odd"><td>Key update</td> <td>-</td> <td>x</td> <td>x</td> <td>o</td> </tr> <tr class="row-even"><td>Common prefix search</td> <td>-</td> <td>x</td> <td>o</td> <td>o</td> </tr> <tr class="row-odd"><td>Predictive search</td> <td>-</td> <td>x</td> <td>o</td> <td>o</td> </tr> <tr class="row-even"><td>Range search</td> <td>-</td> <td>x</td> <td>o</td> <td>o</td> </tr> </tbody> </table> <div class="section" id="table-no-key"> <h3>8.5.2.1. <tt class="docutils literal"><span class="pre">TABLE_NO_KEY</span></tt><a class="headerlink" href="#table-no-key" title="Permalink to this headline">¶</a></h3> <p><tt class="docutils literal"><span class="pre">TABLE_NO_KEY</span></tt> is very fast and very small but it doesn't support key. <tt class="docutils literal"><span class="pre">TABLE_NO_KEY</span></tt> is a only table that doesn't support key.</p> <p>You cannot use <tt class="docutils literal"><span class="pre">TABLE_NO_KEY</span></tt> for lexicon for fulltext search because lexicon stores tokens as key. <tt class="docutils literal"><span class="pre">TABLE_NO_KEY</span></tt> is useful for no key records such as log.</p> </div> <div class="section" id="table-hash-key"> <h3>8.5.2.2. <tt class="docutils literal"><span class="pre">TABLE_HASH_KEY</span></tt><a class="headerlink" href="#table-hash-key" title="Permalink to this headline">¶</a></h3> <p><tt class="docutils literal"><span class="pre">TABLE_HASH_KEY</span></tt> is fast but it doesn't support advanced search functions such as common prefix search and predictive search.</p> <p><tt class="docutils literal"><span class="pre">TABLE_HASH_KEY</span></tt> is useful for index for exact search such as tag search.</p> </div> <div class="section" id="table-pat-key"> <h3>8.5.2.3. <tt class="docutils literal"><span class="pre">TABLE_PAT_KEY</span></tt><a class="headerlink" href="#table-pat-key" title="Permalink to this headline">¶</a></h3> <p><tt class="docutils literal"><span class="pre">TABLE_PAT_KEY</span></tt> is small and supports advanced search functions.</p> <p><tt class="docutils literal"><span class="pre">TABLE_PAT_KEY</span></tt> is useful for lexicon for fulltext search and index for range search.</p> </div> <div class="section" id="table-dat-key"> <h3>8.5.2.4. <tt class="docutils literal"><span class="pre">TABLE_DAT_KEY</span></tt><a class="headerlink" href="#table-dat-key" title="Permalink to this headline">¶</a></h3> <p><tt class="docutils literal"><span class="pre">TABLE_DAT_KEY</span></tt> is fast and supports key update but it is large. It is not suitable for storing many records. <tt class="docutils literal"><span class="pre">TABLE_DAT_KEY</span></tt> is a only table that supports key update.</p> <p><tt class="docutils literal"><span class="pre">TABLE_DAT_KEY</span></tt> is used in groonga database. Groonga database needs to convert object name such as <tt class="docutils literal"><span class="pre">ShortText</span></tt>, <tt class="docutils literal"><span class="pre">TokenBigram</span></tt> and table names to object ID. And groonga database needs to rename object name. Those features are implemented by <tt class="docutils literal"><span class="pre">TABLE_DAT_KEY</span></tt>. The number of objects is small. So large data size demerit of <tt class="docutils literal"><span class="pre">TABLE_DAT_KEY</span></tt> can be ignored.</p> </div> </div> <div class="section" id="record-id"> <h2>8.5.3. Record ID<a class="headerlink" href="#record-id" title="Permalink to this headline">¶</a></h2> <p>Record ID is assigned automatically. You cannot assign record ID.</p> <p>Record ID of deleted record may be reused.</p> <p>Valid record ID range is between 1 and 268435455. (1 and 268435455 are valid IDs.)</p> </div> <div class="section" id="persistent-table-and-temporary-table"> <h2>8.5.4. Persistent table and temporary table<a class="headerlink" href="#persistent-table-and-temporary-table" title="Permalink to this headline">¶</a></h2> <p>Table is persistent table or temporary table.</p> <div class="section" id="persistent-table"> <h3>8.5.4.1. Persistent table<a class="headerlink" href="#persistent-table" title="Permalink to this headline">¶</a></h3> <p>Persistent table is named and registered to database. Records in persistent table aren't deleted after closing table or database.</p> <p>Persistent table can be created by <a class="reference internal" href="commands/table_create.html"><em>table_create</em></a> command.</p> </div> <div class="section" id="temporary-table"> <h3>8.5.4.2. Temporary table<a class="headerlink" href="#temporary-table" title="Permalink to this headline">¶</a></h3> <p>Temporary table is anonymous. Records in temporary table are deleted after closing table. Temporary table is used to store search result, sort result, group (drilldown) result and so on. <tt class="docutils literal"><span class="pre">TABLE_HASH_KEY</span></tt> is used for search result and group result. <tt class="docutils literal"><span class="pre">TABLE_NO_KEY</span></tt> is used for sort result.</p> </div> </div> <div class="section" id="limitations"> <h2>8.5.5. Limitations<a class="headerlink" href="#limitations" title="Permalink to this headline">¶</a></h2> <p>The max number of records is 268435455. You cannot add 268435456 or more records in a table.</p> <p>The max number of a key size is 4096byte. You cannot use 4097byte or larger key. You can use column instead of key for 4097byte or larger size data. <tt class="docutils literal"><span class="pre">Text</span></tt> and <tt class="docutils literal"><span class="pre">LargeText</span></tt> types supports 4097byte or larger size data.</p> <p>The max number of total key size is 4GiB. You need to split a table, split a database (sharding) or reduce each key size to handle 4GiB or more larger total key size.</p> </div> <div class="section" id="see-also"> <h2>8.5.6. See also<a class="headerlink" href="#see-also" title="Permalink to this headline">¶</a></h2> <ul class="simple"> <li><a class="reference internal" href="commands/table_create.html"><em>table_create</em></a></li> </ul> </div> </div> </div> </div> </div> <div class="sphinxsidebar"> <div class="sphinxsidebarwrapper"> <h3><a href="../index.html">Table Of Contents</a></h3> <ul> <li><a class="reference internal" href="#">8.5. Tables</a><ul> <li><a class="reference internal" href="#summary">8.5.1. Summary</a></li> <li><a class="reference internal" href="#characteristics">8.5.2. Characteristics</a><ul> <li><a class="reference internal" href="#table-no-key">8.5.2.1. <tt class="docutils literal"><span class="pre">TABLE_NO_KEY</span></tt></a></li> <li><a class="reference internal" href="#table-hash-key">8.5.2.2. <tt class="docutils literal"><span class="pre">TABLE_HASH_KEY</span></tt></a></li> <li><a class="reference internal" href="#table-pat-key">8.5.2.3. <tt class="docutils literal"><span class="pre">TABLE_PAT_KEY</span></tt></a></li> <li><a class="reference internal" href="#table-dat-key">8.5.2.4. <tt class="docutils literal"><span class="pre">TABLE_DAT_KEY</span></tt></a></li> </ul> </li> <li><a class="reference internal" href="#record-id">8.5.3. Record ID</a></li> <li><a class="reference internal" href="#persistent-table-and-temporary-table">8.5.4. Persistent table and temporary table</a><ul> <li><a class="reference internal" href="#persistent-table">8.5.4.1. Persistent table</a></li> <li><a class="reference internal" href="#temporary-table">8.5.4.2. Temporary table</a></li> </ul> </li> <li><a class="reference internal" href="#limitations">8.5.5. Limitations</a></li> <li><a class="reference internal" href="#see-also">8.5.6. See also</a></li> </ul> </li> </ul> <h4>Previous topic</h4> <p class="topless"><a href="types.html" title="previous chapter">8.4. データ型</a></p> <h4>Next topic</h4> <p class="topless"><a href="normalizers.html" title="next chapter">8.6. Normalizers</a></p> <h3>This Page</h3> <ul class="this-page-menu"> <li><a href="../_sources/reference/tables.txt" rel="nofollow">Show Source</a></li> </ul> <div id="searchbox" style="display: none"> <h3>Quick search</h3> <form class="search" action="../search.html" method="get"> <input type="text" name="q" /> <input type="submit" value="Go" /> <input type="hidden" name="check_keywords" value="yes" /> <input type="hidden" name="area" value="default" /> </form> <p class="searchtip" style="font-size: 90%"> Enter search terms or a module, class or function name. </p> </div> <script type="text/javascript">$('#searchbox').show(0);</script> </div> </div> <div class="clearer"></div> </div> <div class="related"> <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="normalizers.html" title="8.6. Normalizers" >next</a> |</li> <li class="right" > <a href="types.html" title="8.4. データ型" >previous</a> |</li> <li><a href="../index.html">groonga v3.0.5 documentation</a> »</li> <li><a href="../reference.html" >8. リファレンスマニュアル</a> »</li> </ul> </div> <div class="footer"> © Copyright 2009-2013, Brazil, Inc. </div> </body> </html>