{
  "version": "https://jsonfeed.org/version/1", 
  "title": "SQLite", 
  "description": "SQLite is a software library that implements a self-contained, serverless, zero-configuration, transactional SQL database engine.", 
  "home_page_url": "https://www.v2ex.com/go/sqlite", 
  "feed_url": "https://www.v2ex.com/feed/sqlite.json", 
  "icon": "https://cdn.v2ex.com/navatar/1700/0029/292_large.png?m=1645611998", 
  "favicon": "https://cdn.v2ex.com/navatar/1700/0029/292_normal.png?m=1645611998", 
  "items": [
    {
      "author": {
        "url": "https://www.v2ex.com/member/AhFei", 
        "name": "AhFei", 
        "avatar": "https://cdn.v2ex.com/gravatar/3f43d772c3f166336cbc2c328549e6dd?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1218538", 
      "title": "SQLite \u5f00\u542f WAL \u540e\uff0c\u6211\u7684\u540c\u6b65\u670d\u52a1\u541e\u5410\u91cf\u63d0\u5347\u4e86 3 \u500d", 
      "id": "https://www.v2ex.com/t/1218538", 
      "date_published": "2026-06-07T07:14:55+00:00", 
      "content_html": "<p>SQLite \u9ed8\u8ba4\u672a\u5f00\u542f WAL \uff0c\u8fd9\u4f1a\u663e\u8457\u9650\u5236\u5e76\u53d1\u6027\u80fd\u3002</p>\n<p>PlanTodo \u662f\u4e00\u4e2a\u8ba1\u5212\u7ba1\u7406\u8f6f\u4ef6\uff0c\u6700\u8fd1\u6211\u4e3a\u5b83\u7684\u540c\u6b65\u670d\u52a1\u7f16\u5199\u4e86\u6027\u80fd\u6d4b\u8bd5\uff0c\u7ecf\u8fc7\u5b9e\u6d4b\uff0c\u4ec5\u5f00\u542f WAL \u5c31\u8ba9\u540c\u6b65\u670d\u52a1\u7684\u541e\u5410\u91cf\u4fbf\u63d0\u5347\u81f3\u539f\u6765\u7684 3 \u500d\uff0c</p>\n<p>\u5176\u5b9e\u5173\u4e8e SQLite \u6027\u80fd\u4f18\u5316\u7684\u6587\u7ae0\u65e9\u6709\u73e0\u7389\u5728\u524d\uff0c\u6bd4\u5982 <a href=\"https://gcollazo.com/optimal-sqlite-settings-for-django/\" rel=\"nofollow\">Optimal SQLite settings for Django</a> \u548c <a href=\"https://kerkour.com/sqlite-for-servers\" rel=\"nofollow\">Optimizing SQLite for servers</a> \uff0c\u6240\u4ee5\u672c\u7bc7\u6587\u7ae0\u5e76\u6ca1\u6709\u72ec\u521b\u6027\uff0c\u53ea\u662f\u4e3a\u4e86\u8ba9\u66f4\u591a\u4eba\u4e86\u89e3 SQLite \u7684<strong>\u6027\u80fd</strong>\u4ee5\u53ca\u5206\u4eab\u4e00\u4e2a\u771f\u5b9e\u7684\u6027\u80fd<strong>\u6d4b\u8bd5\u7528\u4f8b</strong>\u3002</p>\n<h2>PlanTodo \u540c\u6b65\u670d\u52a1\u6027\u80fd\u6d4b\u8bd5</h2>\n<p>\u6027\u80fd\u6d4b\u8bd5\u5206\u4e3a\u4e09\u4e2a\uff1a</p>\n<ol>\n<li>oo_upload (one user, one device for a user, only upload) \uff0c\u5c31\u662f\u4e00\u4e2a\u7528\u6237\u4e00\u53f0\u8bbe\u5907\u4ec5\u4e0a\u4f20</li>\n<li>oo_download \u5c31\u662f\u4ec5\u4e0b\u8f7d</li>\n<li>oo_cross \u662f\u4e0a\u4f20\u548c\u4e0b\u8f7d\u4ea4\u9519\u8fdb\u884c</li>\n</ol>\n<p>oo_upload \u548c oo_download \u662f\u4e3a\u4e86\u67e5\u770b\u4e0a\u4f20\u548c\u4e0b\u8f7d\u573a\u666f\u4e0b\u7684\u6781\u9650\u6027\u80fd\uff0c\u662f\u4e3a\u4e86\u5c06\u6765\u4e13\u95e8\u4f18\u5316\u65f6\u7528\u6765\u53c2\u8003\u7684\u3002\u800c oo_cross \u5219\u8f83\u4e3a\u8d34\u8fd1\u771f\u5b9e\u4f7f\u7528\u573a\u666f\uff1a\u7528\u6237\u7684\u67d0\u4e2a\u8bbe\u5907\u4e0a\u4f20\u51e0\u4e2a\u66f4\u65b0\uff0c\u53e6\u4e00\u4e2a\u8bbe\u5907\u88ab\u89e6\u53d1\u4e0b\u8f7d\uff1b\u56e0\u6b64\u53ef\u4ee5\u62ff\u5b83\u8ba1\u7b97\u670d\u52a1\u5668\u80fd\u627f\u53d7\u7684\u7528\u6237\u91cf\u3002</p>\n<p>\u5982\u679c\u4f60\u4e0d\u60f3\u770b\u4e0b\u9762\u5177\u4f53\u7684\u6d4b\u8bd5\u6570\u636e\uff0c\u8fd9\u91cc\u7b80\u5355\u5c55\u793a\u4e86\u541e\u5410\u91cf\u7684\u53d8\u5316\uff1a</p>\n<ol>\n<li>oo_upload \uff0c18027 -&gt; 61682 \uff0c\u662f\u539f\u6765\u7684 3.42 \u500d</li>\n<li>oo_download \uff0c17082 -&gt; 49635 \uff0c\u662f\u539f\u6765\u7684 2.90 \u500d</li>\n<li>oo_cross \uff0c17085 -&gt; 44203 \uff0c\u662f\u539f\u6765\u7684 2.58 \u500d</li>\n</ol>\n<blockquote>\n<p>\u4e00\u822c\u67e5\u8be2\u662f\u6bd4\u5199\u5165\u8981\u5feb\u7684\uff0c\u56e0\u6b64\u4e0b\u8f7d\u5e94\u8be5\u6bd4\u4e0a\u4f20\u5feb\uff0c\u4f46 PlanTodo \u7684\u540c\u6b65\u670d\u52a1\u5374\u53cd\u4e86\u8fc7\u6765\uff0c\u8bf4\u660e\u6709\u5f88\u5927\u7684\u4f18\u5316\u7a7a\u95f4\u3002</p>\n</blockquote>\n<hr/>\n<p>\u4e0b\u9762\u662f\u5f00\u542f WAL \u524d\u7684\u6d4b\u8bd5\u6570\u636e\uff1a</p>\n<pre><code>+ just -f services/sync/justfile headless_oo_upload --less-output\n============================================================\nPerformance Summary for test_oo_upload\n============================================================\nRequests      : 18,027\nFailures      : 0\nFailure Rate  : 0.00%\n\nAverage RT    : 78.14 ms\nP50           : 78 ms\nP95           : 110 ms\nP99           : 130 ms\nMax           : 272.81 ms\n\nEndpoints\n------------------------------------------------------------\nPOST /v1/sync/delta\n  Requests=18,011  Avg=78.1ms  P95=110ms  P99=130ms  Max=272.8ms\n\nPOST /v1/clients\n  Requests=8  Avg=76.2ms  P95=110ms  P99=110ms  Max=109.9ms\n\nGET /v1/sync/full\n  Requests=8  Avg=57.2ms  P95=120ms  P99=120ms  Max=120.3ms\n\n\n+ just -f services/sync/justfile headless_oo_download --less-output\n============================================================\nPerformance Summary for test_oo_download\n============================================================\nRequests      : 17,082\nFailures      : 0\nFailure Rate  : 0.00%\n\nAverage RT    : 82.63 ms\nP50           : 82 ms\nP95           : 110 ms\nP99           : 130 ms\nMax           : 370.33 ms\n\nEndpoints\n------------------------------------------------------------\nPOST /v1/sync/delta\n  Requests=16  Avg=172.6ms  P95=370ms  P99=370ms  Max=370.3ms\n\nGET /v1/sync/delta?cursor=1780662404990&amp;limit=100\n  Requests=2,087  Avg=83.4ms  P95=110ms  P99=130ms  Max=316.1ms\n\nGET /v1/sync/delta?cursor=1780662403978&amp;limit=100\n  Requests=2,102  Avg=83.3ms  P95=110ms  P99=130ms  Max=325.5ms\n\n\n+ just -f services/sync/justfile headless_oo_cross --less-output\n============================================================\nPerformance Summary for test_oo_cross\n============================================================\nRequests      : 17,085\nFailures      : 0\nFailure Rate  : 0.00%\n\nAverage RT    : 83.05 ms\nP50           : 82 ms\nP95           : 120 ms\nP99           : 150 ms\nMax           : 245.89 ms\n\nEndpoints\n------------------------------------------------------------\nGET /v1/sync/delta?cursor=1780662760888&amp;limit=100\n  Requests=1  Avg=245.9ms  P95=250ms  P99=250ms  Max=245.9ms\n\nGET /v1/sync/delta?cursor=1780662760900&amp;limit=100\n  Requests=1  Avg=245.4ms  P95=250ms  P99=250ms  Max=245.4ms\n\nGET /v1/sync/delta?cursor=1780662758760&amp;limit=100\n  Requests=1  Avg=228.2ms  P95=230ms  P99=230ms  Max=228.2ms\n</code></pre>\n<p>\u4e0b\u9762\u662f<strong>\u5f00\u542f WAL \u4e4b\u540e</strong>\u7684\u6d4b\u8bd5\u6570\u636e\uff1a</p>\n<pre><code>+ just -f services/sync/justfile headless_oo_upload --less-output\n============================================================\nPerformance Summary for test_oo_upload\n============================================================\nRequests      : 61,682\nFailures      : 0\nFailure Rate  : 0.00%\n\nAverage RT    : 22.30 ms\nP50           : 22 ms\nP95           : 32 ms\nP99           : 41 ms\nMax           : 74.82 ms\n\nEndpoints\n------------------------------------------------------------\nPOST /v1/clients\n  Requests=8  Avg=33.8ms  P95=48ms  P99=48ms  Max=48.1ms\n\nPOST /v1/sync/delta\n  Requests=61,666  Avg=22.3ms  P95=32ms  P99=41ms  Max=74.8ms\n\nGET /v1/sync/full\n  Requests=8  Avg=20.7ms  P95=32ms  P99=32ms  Max=32.5ms\n\n\n+ just -f services/sync/justfile headless_oo_download --less-output\n============================================================\nPerformance Summary for test_oo_download\n============================================================\nRequests      : 49,635\nFailures      : 0\nFailure Rate  : 0.00%\n\nAverage RT    : 28.03 ms\nP50           : 28 ms\nP95           : 38 ms\nP99           : 46 ms\nMax           : 305.64 ms\n\nEndpoints\n------------------------------------------------------------\nPOST /v1/sync/delta\n  Requests=16  Avg=127.0ms  P95=310ms  P99=310ms  Max=305.6ms\n\nGET /v1/sync/delta?cursor=1780663066610&amp;limit=100\n  Requests=6,109  Avg=28.4ms  P95=38ms  P99=46ms  Max=246.0ms\n\nGET /v1/sync/delta?cursor=1780663068640&amp;limit=100\n  Requests=6,064  Avg=28.3ms  P95=38ms  P99=46ms  Max=95.8ms\n\n\n+ just -f services/sync/justfile headless_oo_cross --less-output\n============================================================\nPerformance Summary for test_oo_cross\n============================================================\nRequests      : 44,203\nFailures      : 0\nFailure Rate  : 0.00%\n\nAverage RT    : 31.80 ms\nP50           : 28 ms\nP95           : 45 ms\nP99           : 150 ms\nMax           : 477.37 ms\n\nEndpoints\n------------------------------------------------------------\nGET /v1/sync/delta?cursor=1780663421960&amp;limit=100\n  Requests=1  Avg=477.4ms  P95=480ms  P99=480ms  Max=477.4ms\n\nGET /v1/sync/delta?cursor=1780663421963&amp;limit=100\n  Requests=1  Avg=475.9ms  P95=480ms  P99=480ms  Max=475.9ms\n\nGET /v1/sync/delta?cursor=1780663421966&amp;limit=100\n  Requests=1  Avg=475.4ms  P95=480ms  P99=480ms  Max=475.4ms\n</code></pre>\n<p>\u6bcf\u4e2a\u6d4b\u8bd5\u53ea\u6301\u7eed\u4e86 3 min \uff0c\u56e0\u6b64\u6570\u636e\u91cf\u5f88\u5c0f\uff0c\u5728\u5927\u6570\u636e\u91cf\u7684\u60c5\u51b5\u4e0b\uff0c\u6027\u80fd\u53ef\u80fd\u4f1a\u4e0b\u964d\u5f88\u591a\uff0c\u8fd9\u4e2a\u4f1a\u5728\u5c06\u6765\u8865\u5145\u3002</p>\n<p>\u5728\u6d4b\u8bd5 oo_cross \u91cc\uff0c3min \u5904\u7406\u4e86 44203 \u4e2a\u8bf7\u6c42\uff0c\u4e5f\u5c31\u662f\u4e00\u79d2 245 \u4e2a\u3002\u6d4b\u8bd5\u5176\u5b9e\u662f\u4e0d\u65ad\u5728\u91cd\u590d\u5148\u4e0a\u4f20\u518d\u4e0b\u8f7d\uff0c\u800c\u5ba2\u6237\u7aef\u4e5f\u662f\u4e0a\u4f20\u4e0b\u8f7d\u6210\u5bf9\u51fa\u73b0\uff0c\u56e0\u6b64\u4e00\u79d2\u80fd\u5904\u7406 122 \uff08 245 / 2 \uff09\u53f0\u8bbe\u5907\u7684\u8bf7\u6c42\uff0c\u5373\u4fbf\u56e0\u4e3a\u591a\u7528\u6237\u3001\u591a\u8bbe\u5907\u5e26\u6765\u7684\u5176\u4ed6\u538b\u529b\uff0c\u81f3\u5c11\u80fd\u7a33\u5b9a\u5728\u4e00\u79d2 100 \u4e2a\u8bf7\u6c42\u3002</p>\n<p>\u8003\u8651\u5230\uff0c\u771f\u5b9e\u4f7f\u7528\u4e0b\uff0c\u5e73\u5747\u8981\u51e0\u5206\u949f\u5230\u5341\u51e0\u5206\u949f\u624d\u4f1a\u66f4\u65b0\u4e00\u6b21\u5185\u5bb9\uff0c\u53d6 10 \u5206\u949f\u4e00\u6b21\u7684\u8bdd\uff0c\u4e00\u4e2a\u540c\u6b65\u670d\u52a1\u6781\u9650\u4e0b\u80fd\u652f\u6491 100 x 60 x 10 \uff0c6 \u4e07\u4e2a\u8bbe\u5907\u6b63\u5e38\u4f7f\u7528\u3002</p>\n<h2>\u5982\u4f55\u5f00\u542f WAL</h2>\n<p>\u4e0d\u7ba1\u662f\u4ec0\u4e48 ORM \uff0c\u5f00\u542f\u7684\u65b9\u5f0f\u90fd\u662f\u4e00\u6837\u7684\uff0c\u5c31\u662f\u5728\u8fde\u63a5\u6570\u636e\u5e93\u540e\uff0c\u6267\u884c\u4e00\u6b21 <code>PRAGMA journal_mode=WAL</code>\u3002</p>\n<p>\u5f00\u542f\u4e86 WAL \u540e\uff0c\u5728\u539f\u672c\u7684 SQLite \u6570\u636e\u5e93\u6587\u4ef6\u90a3\u91cc\uff0c\u4f1a\u591a\u51fa\u4e24\u4e2a <code>.db-shm</code>\u3001<code>.db-wal</code> \u7684\u6587\u4ef6\uff0c\u53ef\u4ee5\u4ee5\u6b64\u5224\u65ad\u662f\u5426\u6210\u529f\u5f00\u542f\u3002</p>\n<h3>SQLAlchemy</h3>\n<pre><code class=\"language-python\">from sqlalchemy import create_engine, event\n\nengine = create_engine(\n    DATABASE_URL,\n    echo=False,\n    connect_args={\n        \"timeout\": 5,\n    },\n)\n\nif engine.dialect.name == \"sqlite\":\n    @event.listens_for(engine, \"connect\")\n    def set_sqlite_pragma(dbapi_connection, _):\n        cursor = dbapi_connection.cursor()\n\n        # cursor.execute(\"PRAGMA foreign_keys=ON\")\n        cursor.execute(\"PRAGMA journal_mode=WAL\")\n        cursor.execute(\"PRAGMA synchronous=NORMAL\")\n        cursor.execute(\"PRAGMA temp_store=MEMORY\")\n        cursor.execute(\"PRAGMA cache_size=2000\")\n        cursor.execute(\"PRAGMA mmap_size=134217728\")\n\n        cursor.close()\n</code></pre>\n<blockquote>\n<p>PlanTodo \u7684\u540c\u6b65\u670d\u52a1\u5c31\u662f\u4f7f\u7528 FastAPI + SQLAlchemy \u5f00\u53d1\u7684\u3002\u7531\u4e8e\u540c\u6b65\u670d\u52a1\u7684\u7279\u6b8a\u6027\uff0c\u8fd9\u91cc\u6ca1\u6709\u5f00\u542f\u5916\u952e\u7ea6\u675f\u3002</p>\n</blockquote>\n<h3>Django</h3>\n<p>\u5728\u9879\u76ee\u7684 <a href=\"http://settings.py\" rel=\"nofollow\">settings.py</a> \u6587\u4ef6\u91cc\uff0c\u6dfb\u52a0 init_command\uff1a</p>\n<pre><code class=\"language-python\">DATABASES = {\n    \"default\": {\n        \"ENGINE\": \"django.db.backends.sqlite3\",\n        \"NAME\": BASE_DIR / \"db.sqlite3\",\n        \"OPTIONS\": {\n            \"init_command\": (\n                \"PRAGMA foreign_keys = ON;\"\n                \"PRAGMA journal_mode = WAL;\"\n                \"PRAGMA synchronous = NORMAL;\"\n                \"PRAGMA busy_timeout = 5000;\"\n                \"PRAGMA temp_store = MEMORY;\"\n                \"PRAGMA cache_size = 2000;\"\n                \"PRAGMA mmap_size = 134217728;\"\n            ),\n        },\n    }\n}\n</code></pre>\n<h3>drift</h3>\n<p>\u5728\u6570\u636e\u5e93\u7c7b\u7684 migration get \u65b9\u6cd5\u91cc\uff0c\u5728 beforeOpen \u8fd9\u4e2a\u56de\u8c03\u91cc\u589e\u52a0\u6267\u884c\u547d\u4ee4\uff1a</p>\n<pre><code class=\"language-dart\">class PtdDatabase extends _$PtdDatabase {\n\n  // \u7701\u7565\u65e0\u5173\u4ee3\u7801\n\n  @override\n  MigrationStrategy get migration {\n    return MigrationStrategy(\n      beforeOpen: (details) async {\n        // \u5728\u6bcf\u6b21\u6253\u5f00\u6570\u636e\u5e93\uff0c\u6b63\u5f0f\u4f7f\u7528\u4e4b\u524d\uff0c\u6267\u884c\u7684\u547d\u4ee4\n        await customStatement('PRAGMA journal_mode = WAL');\n        await customStatement('PRAGMA synchronous = NORMAL');\n        await customStatement('PRAGMA busy_timeout = 5000');\n        await customStatement('PRAGMA temp_store = MEMORY');\n        await customStatement('PRAGMA cache_size = -2000');\n      },\n    );\n  }\n}\n</code></pre>\n<hr/>\n<blockquote>\n<p>\u539f\u6587\u94fe\u63a5\uff1a <a href=\"https://yanh.tech/2026/06/sqlite-performance-optimization/\" rel=\"nofollow\">https://yanh.tech/2026/06/sqlite-performance-optimization/</a></p>\n</blockquote>\n<blockquote>\n<p>\u7248\u6743\u58f0\u660e\uff1a\u672c\u535a\u5ba2\u6240\u6709\u6587\u7ae0\u9664\u7279\u5225\u58f0\u660e\u5916\uff0c\u5747\u4e3a AhFei \u539f\u521b\uff0c\u91c7\u7528 <a href=\"https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh\" rel=\"nofollow\">CC BY-NC-SA 4.0</a> \u8bb8\u53ef\u534f\u8bae\u3002\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u6765\u6e90 <a href=\"https://yanh.tech/\" rel=\"nofollow\">\u6280\u7109\u6d32 (yanh.tech)</a> \u3002</p>\n</blockquote>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/cj323", 
        "name": "cj323", 
        "avatar": "https://cdn.v2ex.com/gravatar/55d8713a4741083ba73747a518298a1f?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/1153321", 
      "date_modified": "2025-08-18T16:23:43+00:00", 
      "content_html": "<p>\u6700\u8fd1\u5199\u4e86\u4e2a\u5bf9 sqlite \u6570\u636e\u5e93\u8bfb\u5199\u90fd\u6bd4\u8f83\u5927\u4e14\u9891\u7e41\u7684\u7a0b\u5e8f\uff0c\u8e29\u4e86\u4e00\u4e9b\u5751\u3002\u6700\u540e\u7528\u4e86\u5982\u4e0b\u914d\u7f6e\u6700\u5927\u5316 sqlite3 \u7684\u6027\u80fd\u3002</p>\n<pre><code>PRAGMA journal_mode = WAL;\nPRAGMA busy_timeout = 5000;\nPRAGMA synchronous = NORMAL;\n</code></pre>\n<ol>\n<li>journal_mode = WAL\uff1a \u652f\u6301\u8bfb\u5199\u540c\u65f6\u8fdb\u884c\u3002\u9ad8\u5e76\u53d1\u4e0b\u63d0\u5347\u6700\u660e\u663e</li>\n<li>busy_timeout\uff1a\u53ef\u4ee5\u7f13\u89e3\u540c\u65f6\u591a\u5199\u5165\u65f6\u7684 SQLITE_BUSY \u62a5\u9519\u30025000 \u662f\u4e94\u79d2\u3002</li>\n<li>PRAGMA synchronous = NORMAL; \u51cf\u5c0f\u9ed8\u8ba4\u540c\u6b65\u9891\u7387</li>\n</ol>\n<p>\u5185\u5b58\u591f\u7528\u7684\u8bdd\u8fd8\u53ef\u4ee5\u8bbe\u7f6e\u8fd9\u4e24\u4e2a\u9009\u9879\u52a0\u5927\u5185\u5b58\u7f13\u5b58\u3002</p>\n<pre><code>PRAGMA cache_size = 1000000000;\nPRAGMA temp_store = memory;\n</code></pre>\n", 
      "date_published": "2025-08-18T16:22:51+00:00", 
      "title": "\u5206\u4eab\u9002\u5408\u9ad8\u5e76\u53d1\u573a\u666f\u7684 SQLite \u8bbe\u7f6e", 
      "id": "https://www.v2ex.com/t/1153321"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/MrLonely", 
        "name": "MrLonely", 
        "avatar": "https://cdn.v2ex.com/avatar/a3d4/1bd8/127428_large.png?m=1735887226"
      }, 
      "url": "https://www.v2ex.com/t/884005", 
      "title": "\u5728\u4ec0\u4e48\u60c5\u51b5\u4e0b\u4e00\u5b9a\u8981\u653e\u5f03 SQLite \u91c7\u7528 MySQL \u5462\uff1f", 
      "id": "https://www.v2ex.com/t/884005", 
      "date_published": "2022-09-30T05:00:07+00:00", 
      "content_html": "<p>\u73b0\u5728\u5728\u4e00\u5bb6\u5c0f\u516c\u53f8\u91cc\u5e2e\u5fd9\u505a\u4e00\u4e9b\u6570\u636e\u5904\u7406\uff0c\u91d1\u878d\u65b9\u9762\u7684\u3002\u6570\u636e\u90fd\u662f\u4ece\u4eba\u5de5\u5904\u7406\u8fc7\u7684 Excel \u91cc\u6765\u7684\u3002\u76ee\u524d\u6570\u636e\u653e\u8fdb SQLite \u91cc\u5927\u6982\u6570\u636e\u5e93\u6587\u4ef6\u5927\u5c0f\u5728 500MB \u5de6\u53f3\u3002\u540e\u7eed\u53ef\u80fd\u4f1a\u589e\u957f\u5230\u51e0\u767e GB \u3002</p>\n<p>\u56e0\u4e3a SQLite \u7b80\u5355\uff0c\u4e0d\u9700\u8981\u89e3\u51b3\u914d\u7f6e\uff0c\u7aef\u53e3\uff0c\u7528\u6237\u540d\uff0c\u7b49\u7b49\u590d\u6742\u95ee\u9898\u3002\u5373\u5f00\u5373\u7528\u3002</p>\n<p>\u90a3\u4ee5\u540e\u5230\u4e86\u4ec0\u4e48\u65f6\u5019\u5c31\u8be5\u4ece SQLite \u6362\u5230 MySQL \u4e86\u5462\uff1f\u6216\u8005\u6362\u5230 SQL Server \uff1f</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/join", 
        "name": "join", 
        "avatar": "https://cdn.v2ex.com/avatar/a372/457b/16318_large.png?m=1723696699"
      }, 
      "url": "https://www.v2ex.com/t/869820", 
      "title": "SQLite \u80cc\u540e\u7684\u6545\u4e8b", 
      "id": "https://www.v2ex.com/t/869820", 
      "date_published": "2022-07-31T14:23:13+00:00", 
      "content_html": "<a target=\"_blank\" href=\"https://liyafu.com/2022-07-31-sqlite-untold-story/\" rel=\"nofollow noopener\">https://liyafu.com/2022-07-31-sqlite-untold-story/</a>"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/youthfire", 
        "name": "youthfire", 
        "avatar": "https://cdn.v2ex.com/avatar/8760/d018/33111_large.png?m=1714961788"
      }, 
      "url": "https://www.v2ex.com/t/866001", 
      "title": "\u5e94\u8be5\u600e\u4e48\u7406\u89e3 rowid \u5728 sqlite \u4e2d\u7684\u4f7f\u7528", 
      "id": "https://www.v2ex.com/t/866001", 
      "date_published": "2022-07-13T14:44:21+00:00", 
      "content_html": "S.O \u4e0a\u6211\u8bb0\u5f97\u6709\u4e2a\u8d34<br /><a target=\"_blank\" href=\"https://stackoverflow.com/questions/35876171/sqlite-rowid-after-deleting-rows\" rel=\"nofollow noopener\">https://stackoverflow.com/questions/35876171/sqlite-rowid-after-deleting-rows</a><br />\u5176\u4e2d\u6709\u6bb5\u8bdd\u6211\u5370\u8c61\u5f88\u6df1<br />The data for rowid tables is stored as a B-Tree structure containing one entry for each table row, using the rowid value as the key. This means that retrieving or sorting records by rowid is fast. Searching for a record with a specific rowid, or for all records with rowids within a specified range is around twice as fast as a similar search made by specifying any other PRIMARY KEY or indexed value.<br />\u603b\u7ed3\u8d77\u6765\uff1arowid - \u4e5f\u5c31\u662f true primary key \u6027\u80fd\u4f18\u52bf\u5927<br /><br />\u5728 Sqlite \u5b98\u7f51\u7684 rowid table \u4e2d\uff0c\u53c8\u662f\u8fd9\u4e48\u9610\u8ff0\u7684\uff1aIf the rowid is not aliased by INTEGER PRIMARY KEY then it is not persistent and might change. In particular the VACUUM command will change rowids for tables that do not declare an INTEGER PRIMARY KEY. Therefore, applications should not normally access the rowid directly, but instead use an INTEGER PRIMARY KEY.<br />\u603b\u7ed3\u8d77\u6765\uff1a\u4e0d\u5e94\u8be5\u76f4\u63a5\u4f7f\u7528 rowid<br /><br />\u81ea\u5df1\u5e73\u65f6\u5728\u64cd\u4f5c sqlite select row \u7684\u65f6\u5019\uff0c\u4e00\u76f4\u90fd\u662f\u76f4\u63a5\u7528 rowid \u6765\u9009\u53d6\u6267\u884c\u7684\uff0c\u4e00\u5f00\u59cb\u662f\u4e0d\u77e5\u9053 declare primary key as alias of rowid \uff0c\u540e\u6765\u662f\u53d1\u73b0\u6ca1\u6709\u4f7f\u7528\u573a\u666f\u7528\u5230\u3002\u5b98\u7f51\u8ba9\u4e0d\u8981 direct access \u7684\u539f\u56e0\u662f rowid \u6709\u65f6\u5019\u4f1a\u53d8\uff0c\u6bd4\u5982 VACUUM \u3002\u6211\u6ca1\u6709\u7406\u89e3\u8fd9\u53e5\uff0c\u6211\u5c31\u662f\u9700\u8981 rowid \u91cd\u65b0 rebuild \uff0c\u624d\u4f1a\u53bb\u7528 VACUUM \u7684\u554a\uff0c\u5426\u5219\u5f53\u9891\u7e41\u64cd\u4f5c\u6dfb\u52a0\uff0c\u5220\u9664\u52a8\u4f5c\u540e\uff0c\u4e0d\u8fdb\u884c rebuild \uff0c\u6211\u518d\u7528\u8bed\u53e5\u64cd\u4f5c rowid \uff0c\u53ef\u80fd\u5c31\u4e0d\u662f\u6211\u771f\u6b63\u9700\u8981\u64cd\u4f5c\u7684\u884c\u3002\u6240\u4ee5\u6211\u624d\u6bcf\u6b21\u5728\u8fd9\u4e9b\u52a8\u4f5c\u540e\uff0c\u90fd\u4f1a\u8fdb\u884c VACUUM \u3002\u4e3b\u8981\u662f\u4e3a\u4e86\u903b\u8f91\u4e0d\u51fa\u9519\uff0c\u540c\u65f6\u4e4b\u540e\u8bfb\u53d6\u6027\u80fd\u597d\uff0c\u7a7a\u95f4\u5c0f\u3002<br /><br />\u4f46\u6709\u65f6\u5019 VACUUM \u7684\u65f6\u95f4\u4f1a\u5f88\u957f\uff0c\u53ef\u662f\u4e0d\u64cd\u4f5c\uff0c\u6b64 rowid(true primary key \uff09\u4e0d\u662f\u5f7c rowid \u554a\uff0c\u4f8b\u5982\u5220\u9664\u4e86\u7b2c 6 \u884c\uff0c\u5982\u679c\u4e0d VACUUM, \u6211\u60f3\u518d\u64cd\u4f5c\u65b0\u7684\u7b2c 6 \u884c\uff0c\u8fd9\u4e2a\u65f6\u5019 rowid \u5176\u5b9e\u662f 7 \uff0c\u4e0d\u662f 6 \uff0c\u5c31\u4ea7\u751f\u4e86\u903b\u8f91\u95ee\u9898\u554a\u3002<br /><br />\u9610\u8ff0\u5f97\u7565\u6df7\u4e71\uff0c\u8bf7\u89c1\u8c05\uff01"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/phony2r", 
        "name": "phony2r", 
        "avatar": "https://cdn.v2ex.com/avatar/4eb4/99d2/535530_large.png?m=1657363778"
      }, 
      "url": "https://www.v2ex.com/t/850369", 
      "title": "macOS \u4e0a\u6709\u4ec0\u4e48\u597d\u7528\u7684 SQLite GUI ?", 
      "id": "https://www.v2ex.com/t/850369", 
      "date_published": "2022-05-01T07:29:50+00:00", 
      "content_html": "<p>\u8bd5\u4e86\u4e00\u4e0b sqlitestudio \u548c db-browser, \u90fd\u4e0d\u597d\u7528\u800c\u4e14\u754c\u9762\u4e5f\u5f88\u4e11</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/chenliang0571", 
        "name": "chenliang0571", 
        "avatar": "https://cdn.v2ex.com/avatar/a472/370c/28502_large.png?m=1736635938"
      }, 
      "url": "https://www.v2ex.com/t/845542", 
      "title": "SQLite In-Memory \u4f5c\u4e3a\u6570\u636e\u7f13\u5b58\u4ee3\u66ff Java Object", 
      "id": "https://www.v2ex.com/t/845542", 
      "date_published": "2022-04-07T10:43:11+00:00", 
      "content_html": "<h3>\u80cc\u666f</h3>\n<p>RESTful API \u9700\u8981\u4ece\u6570\u636e\u5e93\u8bfb\u53d6\u5f88\u591a\u57fa\u7840\u6570\u636e\uff0c\u8fd9\u4e9b\u6570\u636e\u6539\u52a8\u5f88\u5c11\uff0c\u6240\u4ee5\u52a0\u4e86\u4e00\u4e2a\u7f13\u5b58 x \u5206\u949f\u5237\u65b0\u4e00\u6b21\u3002\n\u76ee\u524d\u662f\u76f4\u63a5\u4fdd\u5b58\u5230 Java Object \u7684\u3002</p>\n<h3>\u95ee\u9898</h3>\n<p>API \u5404\u7c7b\u8bf7\u6c42\u90fd\u6709\u3002\u57fa\u7840\u6570\u636e\u65b9\u9762\u4e00\u822c\u90fd\u8981\u505a\u4e00\u4e9b\u6570\u636e\u5904\u7406\u7136\u540e\u518d\u7ec4\u5408\u5176\u4ed6\u6570\u636e\u8fd4\u56de\u3002\u7b80\u5355\u7684\u6bd4\u5982 sort \uff0c\u590d\u6742\u7684\u8981\u5148 group by \u7136\u540e\u5728\u7b5b\u9009\u7b49\u3002\n\u4f7f\u7528 Java Stream API \u80fd\u505a\uff0c\u4f46\u662f\u611f\u89c9\u6709\u70b9\u9ebb\u70e6\uff0c\u4e0d\u5982 SQL \u65b9\u4fbf\u3002  </p>\n<hr/>\n<p>\u6240\u4ee5\u60f3\u5230\u4e86 SQLite In-Memory \uff0c\u5982\u679c\u628a\u6570\u636e\u4fdd\u5b58\u5728 SQLite \u5185\uff0c\u90a3\u4e48\u67e5\u8be2\u4f1a\u76f4\u89c2\u5f88\u591a\uff0c\u800c\u4e14\u611f\u89c9\u4f5c\u4e3a In-Memory \u7684\u6570\u636e\u5e93\uff0c\u901f\u5ea6\u5dee\u5f02\u5e94\u8be5\u4e0d\u5927\uff1f</p>\n<p>\u4e0d\u77e5\u9053\u6709\u6ca1\u6709 v \u53cb\u6709\u76f8\u5173\u7ecf\u9a8c\u53ef\u4ee5\u5206\u4eab\u7684\u3002</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/EyebrowsWhite", 
        "name": "EyebrowsWhite", 
        "avatar": "https://cdn.v2ex.com/avatar/530c/66b8/511263_large.png?m=1754383340"
      }, 
      "url": "https://www.v2ex.com/t/841132", 
      "title": "\u4ec0\u4e48\u65f6\u5019\u8c03\u7528 sqlite.close()\u5462", 
      "id": "https://www.v2ex.com/t/841132", 
      "date_published": "2022-03-17T14:57:08+00:00", 
      "content_html": "<p>\u5728 stack overflow \u4e0a\u641c\u4e86\u4e00\u4e0b\uff0c\u56de\u7b54\u6bd4\u8f83\u5c11\uff0c\u800c\u4e14\u770b\u7684\u4e0d\u662f\u5f88\u61c2\uff0c\u7279\u6765\u95ee\u95ee\u8bf8\u4f4d\u3002</p>\n<p>\u524d\u63d0\uff1a\u53ea\u6709\u4e00\u4e2a\u6570\u636e\u5e93</p>\n<p>\u4e3b\u8981\u8003\u8651\u4ee5\u4e0b\u51e0\u79cd\u573a\u666f: </p>\n<ol>\n<li>\u521b\u5efa\u4e00\u4e2a\u6216\u591a\u4e2a\u65b0\u8868</li>\n<li>\u589e\u3001\u5220\u3001\u6539 \u6570\u636e\uff08\u4f7f\u7528\u4e8b\u52a1\uff09</li>\n<li>\u67e5 \u6570\u636e</li>\n</ol>\n<p>\u5982\u679c\u4f7f\u7528 Serialized Mode \uff0c\u90a3\u4e48\u662f\u4e0d\u662f\u65e0\u8bba\u4ec0\u4e48\u65f6\u5019\u90fd\u6ca1\u5fc5\u8981\u53bb\u8c03\u7528 close \u65b9\u6cd5\uff0c\u7b49\u7740\u5783\u573e\u56de\u6536\u5c31\u662f\uff1f</p>\n<p>\u5982\u679c\u4f7f\u7528 Multi-thread/Single-thread Mode \uff0c\u90a3\u4e48\u662f\u4e0d\u662f\u9700\u8981\u5728\u524d\u4e24\u79cd\u573a\u666f\u4e0b\u624b\u52a8\u8c03\u7528 close \u5462\uff1f</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/shellc", 
        "name": "shellc", 
        "avatar": "https://cdn.v2ex.com/avatar/55ae/2484/26509_large.png?m=1646793034"
      }, 
      "url": "https://www.v2ex.com/t/837714", 
      "title": "\u56de\u590d\u201c\u4ec0\u4e48\u573a\u666f\u4e0b\u7528 SQLite\u201d\u7684\u4e3b\u9898\u5e76\u5206\u4eab\u4e00\u4e2a\u5e74\u6536\u5165 60 \u4e07\u5200\u7684\u6280\u672f\u6808", 
      "id": "https://www.v2ex.com/t/837714", 
      "date_published": "2022-03-03T07:43:06+00:00", 
      "content_html": "<p>\u8fd9\u4f4d\u5144\u5f1f\u5728\u95ee<a href=\"https://v2ex.com/t/837599\" rel=\"nofollow\">\u201c\u5927\u5bb6\u6709\u7528 Sqlite \u7684\u5417\uff0c\u90fd\u662f\u4ec0\u4e48\u573a\u666f\u4e0b\u8981\u7528\u8fd9\u4e2a\uff0c\u80fd\u8bf4\u4e00\u4e24\u70b9\u975e\u8981\u7528\u5b83\u7684\u7406\u7531\u6700\u597d\u5566\u201d</a></p>\n<p>\u6211\u89c9\u5f97\u6709\u5fc5\u8981\u5206\u4eab\u4e00\u4e2a\u4eba\u7684\u6545\u4e8b(<a href=\"https://www.indiehackers.com/post/how-pieter-levels-learned-to-code-f61c0019a3\" rel=\"nofollow\">How Pieter Levels learned to code</a>)\uff0c\u8fd9\u4e2a\u53eb Pieter Levels \u7684\u54e5\u4eec\u81ea\u5b66\u7f16\u7a0b\u5199\u4e86\u4e24\u4e2a\u7f51\u7ad9\uff0c\u76ee\u524d\u5df2\u7ecf\u505a\u5230\u6bcf\u5e74\u6536\u5165 60 \u4e07\u5200\u3002\u770b\u770b\u4ed6\u7684\u6280\u672f\u6808\uff1a</p>\n<ul>\n<li>HTML (hand coded so no template to make life easier)</li>\n<li>CSS (He has used pre-processors like LESS and SASS in the past)</li>\n<li>Javascript (No frameworks - this is sometimes referred to jokingly as Vanilla Javascript. There is no such thing as Vanilla JS though. It's just plain-old Javascript without a framework such as React, Vue or Angular)</li>\n<li>jQuery (An unfashionable choice nowadays but it does the job)</li>\n<li>PHP (He doesn't use any frameworks like Laravel)</li>\n<li>sqLite - This is described as being unsuitable for production by it's makers. Still, Pieter says it's super quick and swears by it. SQLite is a database written in a single file so Pieter doesn't need to set up a server for it.</li>\n</ul>\n<p>\u6211\u4e4b\u524d\u63a5\u89e6\u8fc7\u5f88\u591a\u72ec\u7acb\u5f00\u53d1\u8005\u548c\u5c0f\u56e2\u961f\uff0c\u5f88\u591a\u9009\u62e9\u4e86\u975e\u5e38\u91cd\u7684\u67b6\u6784\uff0c\u6bd4\u5982\u5fae\u670d\u52a1\u3001K8S \u3002\u5176\u5b9e\uff0c\u7edd\u5927\u90e8\u5206\u521b\u4e1a\u9879\u76ee\u6700\u540e\u90fd\u6b7b\u6389\u4e86\uff0c\u521b\u4e1a\u56e2\u961f\u628a\u5927\u91cf\u7684\u65f6\u95f4\u6d6a\u8d39\u5728\u4e86\u89e3\u51b3\u6c38\u8fdc\u4e0d\u53ef\u80fd\u53d1\u751f\u7684\u89c4\u6a21\u548c\u590d\u6742\u6027\u95ee\u9898\u4e0a\u3002\u4ed6\u4eec\u81c6\u60f3\u4e86\u4e00\u4e2a\u751c\u871c\u7684\u70e6\u607c\uff0c\u5e76\u82b1\u4e86\u5927\u91cf\u7684\u65f6\u95f4\u548c\u94b1\u6765\u8bd5\u56fe\u89e3\u51b3\u5b83\u3002</p>\n<p>\u4e5f\u6709\u4e00\u4e9b\u5f00\u53d1\u8005\u5f88\u52a1\u5b9e\u7684\u9009\u62e9\u4e86 serverless \u3001django \uff0c\u5feb\u901f rush \u51fa\u4e00\u4e2a MVP \uff0c\u53d1\u73b0\u5546\u4e1a\u4e0d\u53ef\u884c\u5c31\u5feb\u901f\u6254\u6389\u3002</p>\n<p>\u6211\u591a\u5e74\u524d\u770b\u300a\u9ed1\u5ba2\u4e0e\u753b\u5bb6\u300b\uff0cPaul Graham \u8bf4 Lisp \u548c Python \u624d\u662f\u521b\u4e1a\u516c\u53f8\u8be5\u7528\u7684\u8bed\u8a00\uff0c\u5176\u5b9e\u6211\u5e76\u4e0d\u7406\u89e3\uff0c\u6211\u90a3\u65f6\u5019\u8fd8\u5728 C++\u6027\u80fd\u66f4\u597d\u7684\u8ba4\u77e5\u91cc\u3002\u6700\u8fd1\u4e24\u5e74\u5927\u70ed\u7684 No-Code \u548c Low-Code \uff0c\u6211\u4e5f\u6ca1\u6709\u592a\u6df1\u7684\u4f53\u4f1a\u3002</p>\n<p>\u76f4\u5230\u6700\u8fd1\u534a\u5e74\uff0c\u6211\u81ea\u5df1\u7528 Go \u548c Python \u5199\u4e86\u4e24\u4e2a\u5931\u8d25\u7684\u9879\u76ee\uff0c\u6211\u624d\u660e\u767d\u4e86\u3002\u5bf9\u4e8e\u4ee5\u5546\u4e1a\u6210\u529f\u4e3a\u76ee\u6807\u7684\u9879\u76ee\uff0c\u5feb\u901f\u8bd5\u9519\uff0c\u964d\u4f4e\u5199\u4ee3\u7801\u7684\u6210\u672c\u662f\u591a\u4e48\u91cd\u8981\u3002</p>\n"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/papaer", 
        "name": "papaer", 
        "avatar": "https://cdn.v2ex.com/avatar/f110/2c94/538859_large.png?m=1650878542"
      }, 
      "url": "https://www.v2ex.com/t/837599", 
      "date_modified": "2022-03-03T07:01:31+00:00", 
      "content_html": "", 
      "date_published": "2022-03-03T01:54:06+00:00", 
      "title": "\u5927\u5bb6\u6709\u7528 Sqlite \u7684\u5417\uff0c\u90fd\u662f\u4ec0\u4e48\u573a\u666f\u4e0b\u8981\u7528\u8fd9\u4e2a\uff0c\u80fd\u8bf4\u4e00\u4e24\u70b9\u975e\u8981\u7528\u5b83\u7684\u7406\u7531\u6700\u597d\u5566", 
      "id": "https://www.v2ex.com/t/837599"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Livid", 
        "name": "Livid", 
        "avatar": "https://cdn.v2ex.com/avatar/c4ca/4238/1_large.png?m=1783555432"
      }, 
      "url": "https://www.v2ex.com/t/835996", 
      "title": "SQLite Viewer Web App", 
      "id": "https://www.v2ex.com/t/835996", 
      "date_published": "2022-02-23T10:24:38+00:00", 
      "content_html": "\u4e00\u4e2a\u53ef\u4ee5\u5728\u6d4f\u89c8\u5668\u91cc\u4f7f\u7528\u7684 SQLite \u6570\u636e\u5e93\u6d4f\u89c8\u5de5\u5177\u3002<br /><br />\u4f7f\u7528\u4e86\u6d4f\u89c8\u5668\u7684\u539f\u751f\u6587\u4ef6\u7cfb\u7edf API \u6765\u6253\u5f00 .sqlite \u6587\u4ef6\u3002<br /><br />\u4e5f\u53ef\u4ee5\u4f5c\u4e3a PWA \u5b89\u88c5\u3002<br /><br /><a target=\"_blank\" href=\"https://sqliteviewer.app/\" rel=\"nofollow noopener\">https://sqliteviewer.app/</a>"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/zyxk", 
        "name": "zyxk", 
        "avatar": "https://cdn.v2ex.com/avatar/7b48/1ffc/193416_large.png?m=1764699089"
      }, 
      "url": "https://www.v2ex.com/t/797813", 
      "title": "\u672c\u5730\u6570\u636e\u5e93 \u9664\u4e86 SQLite \u8fd8\u6709\u4ec0\u4e48\u597d\u7528\u7684.", 
      "id": "https://www.v2ex.com/t/797813", 
      "date_published": "2021-08-24T16:02:33+00:00", 
      "content_html": "\u672c\u5730\u6570\u636e\u5e93 \u9664\u4e86 SQLite \u8fd8\u6709\u4ec0\u4e48\u597d\u7528\u7684.\u4e3b\u8981\u662f PC \u8f6f\u4ef6\u7528\u7684,\u8f6f\u4ef6\u8981\u514d\u5b89\u88c5.<br />\u597d\u50cf\u5c31 SQLite \u6700\u4f18\u89e3\u4e86\u5427,\u6709\u6ca1\u6709\u5176\u4ed6\u7684\u5462,"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/jk1030", 
        "name": "jk1030", 
        "avatar": "https://cdn.v2ex.com/gravatar/7c52f924084c13fd0212bcef51e75619?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/796202", 
      "title": "\u8bf7\u6559\u4e00\u4e2a\u65b9\u6848\uff0c\u8fb9\u7f18\u8bbe\u5907\u7684 sqlite \u6570\u636e\u5982\u4f55\u624d\u80fd\u83b7\u53d6\u5230", 
      "id": "https://www.v2ex.com/t/796202", 
      "date_published": "2021-08-17T01:34:03+00:00", 
      "content_html": "rt,<br />1.\u7531\u4e8e\u7f51\u7edc\u548c\u73af\u5883\u3002\u6ca1\u6709\u529e\u6cd5\u5b9e\u65f6\u5b58\u5230\u6570\u636e\u8282\u70b9\uff0c\u53ea\u80fd\u5b58\u5728\u672c\u5730\u7684 sqlite,<br />2.\u6570\u636e\u60c5\u51b5\u6bd4\u8f83\u7279\u6b8a\uff0c\u4e0d\u80fd\u4f7f\u7528 mqtt \u534f\u8bae\u7b49<br /><br />\u76ee\u524d\u60f3\u5230\u7684\u662f\u662f\u4e0d\u662f\u53ea\u80fd\u5728\u8bbe\u5907\u4e0a\u641e\u4e00\u4e2a sqlite \u7684\u4ee3\u7406\u670d\u52a1\u4e86"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/lxk11153", 
        "name": "lxk11153", 
        "avatar": "https://cdn.v2ex.com/avatar/f5da/d6c5/447378_large.png?m=1571323366"
      }, 
      "url": "https://www.v2ex.com/t/696413", 
      "date_modified": "2020-08-07T03:58:21+00:00", 
      "content_html": "<ul>\n<li>\u9996\u5148\u6392\u9664 <code>pkg install sqlcipher</code> \uff0c\u8c22\u8c22</li>\n<li>\u6216\u8005\u627e\u5230\u80fd\u5728 Android-6 \u4e0a\u53ef\u8fd0\u884c\u7684 binary</li>\n</ul>\n", 
      "date_published": "2020-08-07T03:53:35+00:00", 
      "title": "\u6709\u4eba\u77e5\u9053\u600e\u4e48\u5728 termux \u4e0a\u7f16\u8bd1 sqlcipher \u5417\uff1f", 
      "id": "https://www.v2ex.com/t/696413"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Iamnotfish", 
        "name": "Iamnotfish", 
        "avatar": "https://cdn.v2ex.com/avatar/455e/aa24/382296_large.png?m=1553022519"
      }, 
      "url": "https://www.v2ex.com/t/588683", 
      "date_modified": "2019-08-02T17:54:10+00:00", 
      "content_html": "<p>| Department | Sub-department | Category | Unit     |<br/>\n| ---------- | -------------- | -------- | -------- |<br/>\n| Id         | Id             | Id       | Id       |<br/>\n| Name       | Name           | Name     | Name     |<br/>\n| Position   | Position       | Position | Position |<br/>\n| Active     |                |          |          |</p>\n<p>\u4e00\u5171\u56db\u5f20\u8868\uff0c\u5173\u7cfb\u4ece\u5de6\u81f3\u53f3\u90fd\u662f\u4e00\u5bf9\u591a\u3002\u73b0\u5728\u6211\u95ee\u9898\u662f\u5982\u679c\u6211\u6dfb\u52a0<strong>\u5916\u952e</strong>\u7528\u6765\u94fe\u8868\u7684\u8bdd\uff0cunit \u8fd9\u5f20\u6700\u5c0f\u7684\u8868\u7684\u6570\u636e\u91cf\u5c06\u4f1a\u975e\u5e38\u5927\u800c\u4e14\u5f88\u591a\u90fd\u662f\u91cd\u590d\u7684\u3002\u56db\u5f20\u8868\u7684\u5177\u4f53\u6570\u636e\u5982\u4e0b\uff1a<br/>\n<em>Department</em>\n| Id   | Name(STR) | Position(INT) | Active(INT) |<br/>\n| ---- | --------- | ------------- | ----------- |<br/>\n| 1    | AAA       | 1             | 0           |<br/>\n| 2    | BBB       | 2             | 0           |<br/>\n| 3    | CCC       | 3             | 1           |<br/>\n| 4    | DDD       | 4             | 1           |</p>\n<p><em>Sub-department</em><br/>\n| Id   | Name(STR) | Position(INT) |<br/>\n| ---- | --------- | ------------- |<br/>\n| 1    | AAA       | 1             |<br/>\n| 2    | BBB       | 2             |<br/>\n| 3    | CCC       | 3             |<br/>\n| 4    | DDD       | 4             |</p>\n<p><em>Category</em><br/>\n| Id   | Name(STR) | Position(INT) |<br/>\n| ---- | --------- | ------------- |<br/>\n| 1    | AAA       | 1             |<br/>\n| 2    | BBB       | 2             |<br/>\n| 3    | CCC       | 3             |<br/>\n| 4    | DDD       | 4             |</p>\n<p><em>Unit</em><br/>\n| Id   | Name(STR) | Position(INT) |<br/>\n| ---- | --------- | ------------- |<br/>\n| 1    | AAA       | 1             |<br/>\n| 2    | BBB       | 2             |<br/>\n| 3    | CCC       | 3             |<br/>\n| 4    | DDD       | 4             |</p>\n<p>\u8bf7\u95ee\u4e00\u4e0b\u6211\u8be5\u600e\u4e48\u4fee\u6539\u6211\u7684\u8868\u7684\u7ed3\u6784\u907f\u514d\u91cd\u590d\u6570\u636e\u4ea7\u751f\u5462\uff1f</p>\n<p>\u8865\u5145\u4e00\u4e0b\uff01\u5177\u4f53\u7684\u4e1a\u52a1\u662f\u7c7b\u4f3c\u4e8e\u8def\u5f84\u67e5\u627e\u90a3\u6837\u7684\uff0c\u70b9\u5f00\u6211\u7684\u7535\u8111\u7136\u540e\u663e\u51fa\u51fa\u6765\u6240\u6709\u7684\u5728\u6211\u7684\u7535\u8111\u4e0b\u7684\u6587\u4ef6\u5939\uff0c\u7136\u540e\u9009\u62e9\u4e0d\u540c\u7684\u6587\u4ef6\u5939\u8fdb\u5165\u91cc\u9762\u5728\u8fdb\u5165\u5230\u5b50\u6587\u4ef6\u5939\u8fd9\u6837\u3002</p>\n", 
      "date_published": "2019-08-02T17:49:09+00:00", 
      "title": "\u6c42\u4e00\u4e2a\u6570\u636e\u5e93\u8bbe\u8ba1\u95ee\u9898\uff01", 
      "id": "https://www.v2ex.com/t/588683"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/hxt", 
        "name": "hxt", 
        "avatar": "https://cdn.v2ex.com/avatar/7113/6483/326759_large.png?m=1583290816"
      }, 
      "url": "https://www.v2ex.com/t/531196", 
      "title": "SQLite \u88ab\u66dd\u6f0f\u6d1e,\u5f71\u54cd\u8303\u56f4\u5f88\u5927", 
      "id": "https://www.v2ex.com/t/531196", 
      "date_published": "2019-01-28T04:23:45+00:00", 
      "content_html": "\u524d\u6bb5\u65e5\u5b50\uff0c\u817e\u8baf\u5b89\u5168\u5e73\u53f0\u53d1\u73b0\uff0cSQLite \u5b58\u5728\u4e00\u7ec4\u540d\u4e3a\"\u9ea6\u54f2\u4f26\"\u7684\u6f0f\u6d1e\uff0c\u5229\u7528\u8fd9\u7ec4\u6f0f\u6d1e\uff0c\u653b\u51fb\u8005\u53ef\u4ee5\u5728\u7528\u6237\u8bbe\u5907\u4e0a\u8fdc\u7a0b\u8fd0\u884c\u6076\u610f\u4ee3\u7801\uff0c\u5bfc\u81f4\u7528\u6237\u9690\u79c1\u6570\u636e\u6cc4\u6f0f\u6216\u8bbe\u5907\u88ab\u63a7\u5236\u3002<br /><br />SQLite \u662f\u4e00\u6b3e\u57fa\u4e8e\u78c1\u76d8\u7684\u5173\u7cfb\u6570\u636e\u5e93\u7ba1\u7406\u7cfb\u7edf\uff0c\u51e0\u4e4e\u53ef\u4e0e\u6240\u6709\u8bbe\u5907\u3001\u5e73\u53f0\u548c\u7f16\u7a0b\u8bed\u8a00\u517c\u5bb9\u3002\u622a\u81f3\u76ee\u524d\uff0c\u5df2\u6709\u6570\u767e\u4e07\u5e94\u7528\u7a0b\u5e8f\u4f7f\u7528 SQLite \u5b8c\u6210\u4e86\u6570\u5341\u4ebf\u6b21\u5b89\u88c5\uff0c\u4f17\u591a\u7269\u8054\u7f51\u8bbe\u5907\u3001Windows \u5e94\u7528\u7a0b\u5e8f\u3001mac OS \u53ca Web \u6d4f\u89c8\u5668\u6613\u53d7\u5f71\u54cd\u3002\u6bd4\u8f83\u5178\u578b\u7684\u662f\u57fa\u4e8e Chromium \u7684\u6d4f\u89c8\u5668\uff0c\u5305\u62ec Google Chrome\u3001Vivaldi\u3001Opera \u548c Brave \u7b49\u4e3b\u6d41\u6d4f\u89c8\u5668\u53d7\u5230\u5f71\u54cd\u3002<br /><br />\u5982\u679c\u7528\u6237\u4f7f\u7528\u4e86\u6ca1\u6709\u4fee\u590d\u6f0f\u6d1e\u7684\u6d4f\u89c8\u5668\u6216\u8005 APP\uff0c\u4e00\u4e2a\u5f88\u5e38\u89c1\u7684\u573a\u666f\u5c31\u662f\uff0c\u6253\u5f00\u653b\u51fb\u8005\u7684\u7f51\u7ad9(\u6216\u8005\u626b\u63cf\u4e8c\u7ef4\u7801)\uff0c\u653b\u51fb\u8005\u5c31\u53ef\u4ee5\u8fdc\u7a0b\u5728\u7528\u6237\u7684\u6d4f\u89c8\u5668\u6216\u8005 APP \u91cc\u6267\u884c\u4efb\u610f\u547d\u4ee4\u3002<br /><br /><a target=\"_blank\" href=\"https://blade.tencent.com/magellan/index.html\" rel=\"nofollow\">https://blade.tencent.com/magellan/index.html</a>"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/dalieba", 
        "name": "dalieba", 
        "avatar": "https://cdn.v2ex.com/avatar/3364/fcbb/301234_large.png?m=1542988025"
      }, 
      "url": "https://www.v2ex.com/t/497522", 
      "title": "\u4e24\u4e2a\u8bfb\u5199 SQLite \u6570\u636e\u5e93\u7684\u6d4f\u89c8\u5668\u6269\u5c55", 
      "id": "https://www.v2ex.com/t/497522", 
      "date_published": "2018-10-14T08:16:01+00:00", 
      "content_html": "\u6709\u4e24\u5bb6\u7f51\u7ad9\u53d1\u5e03\u4e86\u53ef\u4ee5\u8ba9\u6d4f\u89c8\u5668\u7f16\u8f91 SQLite \u7684\u6269\u5c55\uff0c\u53ea\u9700\u4e00\u4e2a sql.js \u5c31\u80fd\u8dd1\u8d77\u6765\u4e00\u4e2a\u6570\u636e\u5e93\u3002<br /><a target=\"_blank\" href=\"http://add0n.com/sqlite-manager.html\" rel=\"nofollow\">http://add0n.com/sqlite-manager.html</a><br /><a target=\"_blank\" href=\"http://mybrowseraddon.com/sql-reader.html\" rel=\"nofollow\">http://mybrowseraddon.com/sql-reader.html</a>"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Livid", 
        "name": "Livid", 
        "avatar": "https://cdn.v2ex.com/avatar/c4ca/4238/1_large.png?m=1783555432"
      }, 
      "url": "https://www.v2ex.com/t/52719", 
      "title": "How SQLite is tested", 
      "id": "https://www.v2ex.com/t/52719", 
      "date_published": "2012-11-18T13:16:39+00:00", 
      "content_html": "<a href=\"http://sqlite.org/testing.html\" rel=\"nofollow\">http://sqlite.org/testing.html</a>"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/013231", 
        "name": "013231", 
        "avatar": "https://cdn.v2ex.com/gravatar/3d91a083d47c66019bcda1f3a9b32fde?s=73&d=retro"
      }, 
      "url": "https://www.v2ex.com/t/40127", 
      "title": "\u5982\u679c\u9700\u8981\u5beb\u5165\u6578\u64da, \u4e0d\u50c5\u6578\u64da\u6587\u4ef6\u8981\u6709\u5beb\u5165\u6b0a\u9650, \u6578\u64da\u6587\u4ef6\u6240\u5728\u7684\u76ee\u9304\u4e5f\u8981\u6709\u5beb\u5165\u6b0a\u9650", 
      "id": "https://www.v2ex.com/t/40127", 
      "date_published": "2012-06-20T17:15:25+00:00", 
      "content_html": "\"When a process wants to change a database file (and it is not in WAL mode), it first records the original unchanged database content in a rollback journal. The rollback journal is an ordinary disk file that is always located in the same directory or folder as the database file and has the same name as the database file with the addition of a -journal suffix. The rollback journal also records the initial size of the database so that if the database file grows it can be truncated back to its original size on a rollback.\"<br />\u6240\u4ee5\u5462, \u5982\u679c\u6578\u64da\u6587\u4ef6\u6240\u5728\u7684\u76ee\u9304\u6c92\u7528\u5beb\u6b0a\u9650, journal\u6587\u4ef6\u7121\u6cd5\u5275\u5efa, \u5c31\u7121\u6cd5\u5beb\u5165\u6578\u64da\u4e86.<br /><br />\u5728Python sqlite3 Package\u4e2d, \u6703\u62cb\u51fa\u4e00\u500b\u9817\u6709\u8aa4\u5c0e\u6027\u7684Error:<br />OperationalError: unable to open database file<br />\u7136\u800c\u771f\u6b63\u7684\u932f\u8aa4\u539f\u56e0\u4e26\u4e0d\u662f\u7121\u6cd5\u6253\u958b\u6578\u64da\u6587\u4ef6, \u800c\u662f\u7121\u6cd5\u5275\u5efa\u65e5\u8a8c\u6587\u4ef6.<br />\u88ab\u9019\u500b\u554f\u984c\u6298\u9a30\u4e86\u534a\u5929..."
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/yetone", 
        "name": "yetone", 
        "avatar": "https://cdn.v2ex.com/avatar/d440/03cb/13218_large.png?m=1752160683"
      }, 
      "url": "https://www.v2ex.com/t/39535", 
      "date_modified": "2012-06-14T17:26:53+00:00", 
      "content_html": "\u4f1a\u4e0d\u4f1a\u627f\u53d7\u4e0d\u4e86\u5f88\u5927\u7684\u8bf7\u6c42\u554a\uff0c\u6b63\u5728\u8003\u8651\u8981\u4e0d\u8981\u8f6c\u6210mysql\uff0csqlite3\u548cmysql\u7684\u8bed\u6cd5\u76f8\u5dee\u5927\u4e0d\u5927\uff1f", 
      "date_published": "2012-06-14T15:47:59+00:00", 
      "title": "\u7528sqlite3\u4f5c\u4e3a\u8bba\u575b\u7684\u6570\u636e\u5e93\u884c\u4e0d\u884c\uff1f", 
      "id": "https://www.v2ex.com/t/39535"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/jyoe", 
        "name": "jyoe", 
        "avatar": "https://cdn.v2ex.com/avatar/359f/3846/1390_large.png?m=1589356623"
      }, 
      "url": "https://www.v2ex.com/t/33481", 
      "date_modified": "2012-04-25T02:48:39+00:00", 
      "content_html": "About Sqlite<br />1001 wget <a target=\"_blank\" href=\"http://www.sqlite.org/sqlite-autoconf-3071100.tar.gz\">http://www.sqlite.org/sqlite-autoconf-3071100.tar.gz</a><br />1002 tar zxvf sqlite-autoconf-3071100.tar.gz<br />1003 cd sqlite-autoconf-3071100<br />1008 ./configure<br />1009 make<br />1010 make install<br /><br />sqlite3 test // \u6ca1\u6709\u5c31\u521b\u5efa\u8fd9\u4e2adb \u6709\u4e86\u5c31\u8fdb\u5165\u8be5db \u6211\u9760 \u597d\u7075\u5de7<br />\u6728\u6709show tables; \u4f46\u53ef\u4ee5\u7528.tables or .table<br />\u6728\u6709show databases; \u4f46\u6709.databases;<br />sqlite&gt; .schema<br />CREATE TABLE user(id integer primary key,username text ,country text);<br />CREATE TABLE user_card(id integer primary key,username text ,country text);<br />sqlite&gt; .schema user<br />CREATE TABLE user(id integer primary key,username text ,country text);<br /><br />\u8fd9\u8ba9show create table xxx \u60c5\u4f55\u4ee5\u582a...<br /><br /><br />order by \u5565\u7684\u8fd8\u90fd\u6b63\u5e38<br /><br />DataType\u53ef\u601c \u4f46\u7cbe\u5de7\u591f\u7528 <br />NULL<br />INTEGER<br />REAL<br />TEXT<br />BLOB<br />\u4f46\u8c8c\u4f3c\u4e5f\u652f\u6301date time\u5565\u7684\u8fd9\u4e9b\u5e38\u89c4Type<br /><br /><br />About Create Index<br />CREATE [UNIQUE] INDEX index-name<br />ON [database-name .] table-name (column-name [, column-name]*)<br />[ON CONFLICT conflict-algorithm]<br /><br />Query:<br />SELECT [ALL | DISTINCT] result [FROM table-list]<br />[WHERE expr]<br />[GROUP BY expr-list]<br />[HAVING expr]<br />[compound-op select]*<br />[ORDER BY sort-expr-list]<br />[LIMIT integer [(OFFSET|,) integer]]<br /><br />sqlite3\u4e5f\u63a5\u53d7\u5982\u4e0b\u7684\u6570\u636e\u7c7b\u578b\uff1a<br />smallint 16 \u4f4d\u5143\u7684\u6574\u6570\u3002<br />interger 32 \u4f4d\u5143\u7684\u6574\u6570\u3002<br />decimal(p,s) p \u7cbe\u786e\u503c\u548c s \u5927\u5c0f\u7684\u5341\u8fdb\u4f4d\u6574\u6570\uff0c\u7cbe\u786e\u503cp\u662f\u6307\u5168\u90e8\u6709\u51e0\u4e2a\u6570(digits)\u5927\u5c0f\u503c\uff0cs\u662f\u6307\u5c0f\u6570\u70b9\u5f8c\u6709\u51e0\u4f4d\u6570\u3002\u5982\u679c\u6ca1\u6709\u7279\u522b\u6307\u5b9a\uff0c\u5219\u7cfb\u7edf\u4f1a\u8bbe\u4e3a p=5; s=0 \u3002<br />float 32\u4f4d\u5143\u7684\u5b9e\u6570\u3002<br />double 64\u4f4d\u5143\u7684\u5b9e\u6570\u3002<br />char(n) n \u957f\u5ea6\u7684\u5b57\u4e32\uff0cn\u4e0d\u80fd\u8d85\u8fc7 254\u3002<br />varchar(n) \u957f\u5ea6\u4e0d\u56fa\u5b9a\u4e14\u5176\u6700\u5927\u957f\u5ea6\u4e3a n \u7684\u5b57\u4e32\uff0cn\u4e0d\u80fd\u8d85\u8fc7 4000\u3002<br />graphic(n) \u548c char(n) \u4e00\u6837\uff0c\u4e0d\u8fc7\u5176\u5355\u4f4d\u662f\u4e24\u4e2a\u5b57\u5143 double-bytes\uff0c n\u4e0d\u80fd\u8d85\u8fc7127\u3002\u8fd9\u4e2a\u5f62\u6001\u662f\u4e3a\u4e86\u652f\u63f4\u4e24\u4e2a\u5b57\u5143\u957f\u5ea6\u7684\u5b57\u4f53\uff0c\u4f8b\u5982\u4e2d\u6587\u5b57\u3002<br />vargraphic(n) \u53ef\u53d8\u957f\u5ea6\u4e14\u5176\u6700\u5927\u957f\u5ea6\u4e3a n \u7684\u53cc\u5b57\u5143\u5b57\u4e32\uff0cn\u4e0d\u80fd\u8d85\u8fc7 2000<br />date \u5305\u542b\u4e86 \u5e74\u4efd\u3001\u6708\u4efd\u3001\u65e5\u671f\u3002<br />time \u5305\u542b\u4e86 \u5c0f\u65f6\u3001\u5206\u949f\u3001\u79d2\u3002<br />timestamp \u5305\u542b\u4e86 \u5e74\u3001\u6708\u3001\u65e5\u3001\u65f6\u3001\u5206\u3001\u79d2\u3001\u5343\u5206\u4e4b\u4e00\u79d2\u3002<br /><br />Sqlite Datetime<br />sqlite&gt; SELECT strftime('%Y/%m/%d', '2004-10-31');<br />2004/10/31<br />sqlite&gt; SELECT strftime('%Y/%m/%d', datetime());<br />2012/04/05<br /><br />sqlite&gt; SELECT strftime('%Y-%m-%d %H:%M:%S', datetime());<br />2012-04-05 03:02:57<br /><br />sqlite&gt; SELECT strftime('%Y-%m-%d %H:%M:%S day of the week:%w Week of year:%W', datetime());<br />2012-04-05 03:04:52 day of the week:4 Week of year:14<br /><br />// %w Day of week, 0-6 (0 is Sunday)<br /><br /><br />SELECT strftime('%H:%M:%S',time(), '+1 hours'); // \u4e00\u4e2a\u5c0f\u65f6\u4e4b\u540e<br />SELECT strftime('%Y-%m-%d %H:%M:%S',datetime(),'+1 years'); //\u4e00\u5e74\u4e4b\u540e<br />SELECT strftime('%Y-%m-%d %H:%M:%S',datetime(),'+1 hours','+1 years'); // \u4e00\u5e74\u4e4b\u540e\u7684\u8fd9\u4e00\u5929\u7684\u4e00\u5c0f\u65f6\u4ee5\u540e <br />SELECT datetime('now', 'start of month'); // 2012-04-01 00:00:00 \u8fd9\u4e2a\u6708\u7684\u7b2c\u4e00\u5929 month\u53ef\u4ee5\u6539\u6210\u5e74<br />SELECT time('12:00', 'localtime'); <br />SELECT time('12:00', 'utc');", 
      "date_published": "2012-04-25T02:47:50+00:00", 
      "title": "About Sqlite \u4e4b\u524d\u7684\u4e00\u7bc7\u7b14\u8bb0", 
      "id": "https://www.v2ex.com/t/33481"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/hermitu", 
        "name": "hermitu", 
        "avatar": "https://cdn.v2ex.com/avatar/92a0/8bf9/3141_large.png?m=1331654102"
      }, 
      "url": "https://www.v2ex.com/t/25395", 
      "date_modified": "2012-04-21T16:53:13+00:00", 
      "content_html": "\u7528sqlfairy\u8f6c\u6362sqlite\u5230mysql\uff0c\u4f46\u662f\u8f6c\u6362\u4e2d\u9014\u663e\u793aout of memory. \u6211\u60f3\u662fsqlite\u6587\u4ef6\u592a\u5927\u4e86\u5427\uff0c\u5982\u679c\u5206\u5272\u6210\u5c0f\u7684\uff0c\u4f30\u8ba1\u5c31\u89e3\u51b3\u95ee\u9898\u4e86\u3002\u3002\u3002\u4f46\u662f\u6ca1\u627e\u5230\u5206\u5272\u5de5\u5177\u3002", 
      "date_published": "2012-01-11T07:48:50+00:00", 
      "title": "\u5982\u4f55\u628a\u4e00\u4e2a2G\u7684sqlite\u6570\u636e\u5e93\u5206\u5272\u6210\u5c0f\u7684\uff1f", 
      "id": "https://www.v2ex.com/t/25395"
    }, 
    {
      "author": {
        "url": "https://www.v2ex.com/member/Livid", 
        "name": "Livid", 
        "avatar": "https://cdn.v2ex.com/avatar/c4ca/4238/1_large.png?m=1783555432"
      }, 
      "url": "https://www.v2ex.com/t/12281", 
      "date_modified": "2012-04-21T14:23:01+00:00", 
      "content_html": "<a href=\"http://menial.co.uk/2011/02/18/base-2-0/\" rel=\"nofollow\">http://menial.co.uk/2011/02/18/base-2-0/</a>\r\n<br />\r\n<br />The best SQLite manager for Mac OS X.", 
      "date_published": "2011-04-28T10:41:23+00:00", 
      "title": "Base 2.0", 
      "id": "https://www.v2ex.com/t/12281"
    }
  ]
}