<tfoot id='FIY73'></tfoot>
  1. <small id='FIY73'></small><noframes id='FIY73'>

        <bdo id='FIY73'></bdo><ul id='FIY73'></ul>
    1. <legend id='FIY73'><style id='FIY73'><dir id='FIY73'><q id='FIY73'></q></dir></style></legend>

      <i id='FIY73'><tr id='FIY73'><dt id='FIY73'><q id='FIY73'><span id='FIY73'><b id='FIY73'><form id='FIY73'><ins id='FIY73'></ins><ul id='FIY73'></ul><sub id='FIY73'></sub></form><legend id='FIY73'></legend><bdo id='FIY73'><pre id='FIY73'><center id='FIY73'></center></pre></bdo></b><th id='FIY73'></th></span></q></dt></tr></i><div id='FIY73'><tfoot id='FIY73'></tfoot><dl id='FIY73'><fieldset id='FIY73'></fieldset></dl></div>

      SQLite 中的主键是否需要索引?

      Is an index needed for a primary key in SQLite?(SQLite 中的主键是否需要索引?)

        <small id='riNQR'></small><noframes id='riNQR'>

      1. <tfoot id='riNQR'></tfoot>
              <legend id='riNQR'><style id='riNQR'><dir id='riNQR'><q id='riNQR'></q></dir></style></legend>
                <bdo id='riNQR'></bdo><ul id='riNQR'></ul>
                  <tbody id='riNQR'></tbody>
                <i id='riNQR'><tr id='riNQR'><dt id='riNQR'><q id='riNQR'><span id='riNQR'><b id='riNQR'><form id='riNQR'><ins id='riNQR'></ins><ul id='riNQR'></ul><sub id='riNQR'></sub></form><legend id='riNQR'></legend><bdo id='riNQR'><pre id='riNQR'><center id='riNQR'></center></pre></bdo></b><th id='riNQR'></th></span></q></dt></tr></i><div id='riNQR'><tfoot id='riNQR'></tfoot><dl id='riNQR'><fieldset id='riNQR'></fieldset></dl></div>

              • 本文介绍了SQLite 中的主键是否需要索引?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                当一个整数列在 SQLite 表中被标记为主键时,是否也应该为它显式创建索引?SQLite 似乎不会自动为主键列创建索引,但鉴于其目的,它可能无论如何都会对其进行索引?(我会一直在那个专栏上搜索)

                字符串主键的情况会有所不同吗?

                解决方案

                它为您做到了.

                一个>

                <块引用>

                INTEGER PRIMARY KEY 列放在一边,UNIQUE 和 PRIMARY KEY约束是通过在数据库中创建索引来实现的(在与CREATE UNIQUE INDEX"语句相同的方式).这样一个索引像数据库中的任何其他索引一样用于优化查询.因此,通常没有优势(但显着的开销)在一组已经存在的列上创建索引共同受 UNIQUE 或 PRIMARY KEY 约束.

                When an integer column is marked as a primary key in an SQLite table, should an index be explicitly created for it as well? SQLite does not appear to automatically create an index for a primary key column, but perhaps it indexes it anyway, given its purpose? (I will be searching on that column all the time).

                Would the situation be any different for a string primary key?

                解决方案

                It does it for you.

                INTEGER PRIMARY KEY columns aside, both UNIQUE and PRIMARY KEY constraints are implemented by creating an index in the database (in the same way as a "CREATE UNIQUE INDEX" statement would). Such an index is used like any other index in the database to optimize queries. As a result, there often no advantage (but significant overhead) in creating an index on a set of columns that are already collectively subject to a UNIQUE or PRIMARY KEY constraint.

                这篇关于SQLite 中的主键是否需要索引?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                相关文档推荐

                plist or sqlite(plist 或 sqlite)
                Rails 4.0rc1 app not running due to missing sqlite3 gem(由于缺少 sqlite3 gem,Rails 4.0rc1 应用程序没有运行)
                strftime error while switching my database from sqlite3 to mysql in Rails4(在 Rails4 中将我的数据库从 sqlite3 切换到 mysql 时出现 strftime 错误)
                SQLite: bind list of values to quot;WHERE col IN ( :PRM )quot;(SQLite:将值列表绑定到“WHERE col IN (:PRM);)
                How to add results of two select commands in same query(如何在同一个查询中添加两个选择命令的结果)
                Encrypted file or db in python(python中的加密文件或数据库)
                <i id='WFgUi'><tr id='WFgUi'><dt id='WFgUi'><q id='WFgUi'><span id='WFgUi'><b id='WFgUi'><form id='WFgUi'><ins id='WFgUi'></ins><ul id='WFgUi'></ul><sub id='WFgUi'></sub></form><legend id='WFgUi'></legend><bdo id='WFgUi'><pre id='WFgUi'><center id='WFgUi'></center></pre></bdo></b><th id='WFgUi'></th></span></q></dt></tr></i><div id='WFgUi'><tfoot id='WFgUi'></tfoot><dl id='WFgUi'><fieldset id='WFgUi'></fieldset></dl></div>
                  <bdo id='WFgUi'></bdo><ul id='WFgUi'></ul>

                  <tfoot id='WFgUi'></tfoot>
                    <tbody id='WFgUi'></tbody>

                • <small id='WFgUi'></small><noframes id='WFgUi'>

                  <legend id='WFgUi'><style id='WFgUi'><dir id='WFgUi'><q id='WFgUi'></q></dir></style></legend>