Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikipediaThe Free Encyclopedia
Search

SQLite

From Wikipedia, the free encyclopedia
Serverless relational database management system
SQLite
Screenshot ofsqlite3 command-line shell program
DeveloperD. Richard Hipp
Initial release17 August 2000;
25 years ago
 (2000-08-17)
Stable release3.51.0[1] Edit this on Wikidata (4 November 2025; 21 days ago (4 November 2025))
Repository
Written inC
Operating systemCross-platform
Size699 KiB
TypeRDBMS (embedded)
LicensePublic domain[2]
Websitesqlite.orgEdit this at Wikidata
SQLite Database File Format
Filename extension
.sqlite, .sqlite3, .db, .db3, .s3db, .sl3
Internet media typeapplication/vnd.sqlite3[3]
Magic number53 51 4c 69 74 65 20 66 6f 72 6d 61 74 20 33 00 (zero-terminatedASCII "SQLite format 3")
Initial release2004-06-18
Open format?yes (Public Domain)
Websitesqlite.org/fileformat.html

SQLite (/ˌɛsˌkjuːˌɛlˈt/ "S-Q-L-ite",[4][5]/ˈskwəˌlt/ "sequel-ite"[6]) is afree and open-sourcerelationaldatabase engine written in theC programming language. It is not a standalone app; rather, it is alibrary thatsoftware developers embed in theirapps. As such, it belongs to the family ofembedded databases. According to its developers, SQLite is the most widely deployed database engine, as it is used by several of the topweb browsers,operating systems,mobile phones, and otherembedded systems.[7]

Manyprogramming languages havebindings to the SQLite library. It generally followsPostgreSQL syntax, but does not enforcetype checking by default.[8][9] This means that one can, for example, insert a string into acolumn defined as an integer. Although it is a lightweight embedded database, SQLite implements most of theSQL standard and therelational model, includingtransactions andACID guarantees.[10] However, it omits many features implemented by other databases, such asmaterialized views and complete support fortriggers andALTER TABLE statements.[11]

History

[edit]

D. Richard Hipp designed SQLite in the spring of 2000 while working forGeneral Dynamics on contract with theUnited States Navy.[12] Hipp was designing software used for adamage-control system aboardguided-missile destroyers; the damage-control system originally usedHP-UX with anInformixdatabase back-end. SQLite began as aTcl extension.[13]

In August 2000, version 1.0 of SQLite was released, with storage based ongdbm (GNU Database Manager). In September 2001, SQLite 2.0 replaced gdbm with a customB-tree implementation,[a] addingtransaction capability. In June 2004, SQLite 3.0 addedinternationalization,manifest typing, and other major improvements, partially funded byAmerica Online. In 2011, Hipp announced his plans to add aNoSQL interface to SQLite, as well as announcing UnQL, a functional superset ofSQL designed fordocument-oriented databases.[15]

SQLite is one of four formats recommended for long-term storage ofdatasets approved for use by theLibrary of Congress.[16][17][18]

Design

[edit]

SQLite was designed to allow the program to be operated without installing a database management system or requiring adatabase administrator. Unlikeclient–server database management systems, the SQLite engine has no standaloneprocesses with which the application program communicates. Instead, alinker integrates the SQLite library—statically ordynamically—into an application program which uses SQLite's functionality through simplefunction calls, reducinglatency in database operations; for simple queries with little concurrency, SQLiteperformance profits from avoiding the overhead ofinter-process communication.

Due to the serverless design, SQLite applications require less configuration than client–server databases. SQLite is calledzero-configuration[19] because configuration tasks such as service management, startup scripts, and password- orGRANT-based access control are unnecessary.Access control is handled through thefile-system permissions of the database file.[20] Databases in client–server systems usefile-system permissions that give access to the database files only to thedaemon process, which handles its locks internally, allowingconcurrent writes from several processes.

SQLite stores the entire database, consisting of definitions,tables, indices, and data, as a singlecross-platform file, allowing several processes orthreads to access the same database concurrently. It implements this simple design bylocking the database file during writing.[20] Write access may fail with anerror code, or it can be retried until a configurable timeout expires. SQLite read operations can bemultitasked, though due to the serverless design, writes can only be performed sequentially. This concurrent access restriction does not apply to temporary tables, and it is relaxed in version 3.7 aswrite-ahead logging (WAL) enables concurrent reads and writes.[21] Since SQLite has to rely on file-system locks, it is not the preferred choice for write-intensive deployments.[22]

SQLite usesPostgreSQL as a reference platform. "What would PostgreSQL do" is used to make sense of the SQL standard.[23][24] One major deviation is that, with the exception ofprimary keys, SQLite does not enforcetype checking; the type of a value is dynamic and not strictly constrained by theschema (although the schema will trigger a conversion when storing, if such a conversion is potentially reversible). SQLite strives to followPostel's rule.[25]

Features

[edit]

SQLite implements most of theSQL-92 standard for SQL, but lacks some features. For example, it only partially providestriggers and cannot write toviews (however, it provides INSTEAD OF triggers that provide this functionality). Its support ofALTER TABLE statements is limited.[26]

SQLite uses an unusualtype system for an SQL-compatible DBMS: instead of assigning atype to a column as in most SQL database systems, types are assigned to individual values; in language terms it isdynamically typed. Moreover, it isweakly typed in some of the same ways thatPerl is: one can insert astring into aninteger column (although SQLite will try to convert the string to an integer first, if the column's preferred type is integer). This adds flexibility to columns, especially when bound to a dynamically typed scripting language. However, the technique is not portable to other SQL products. A common criticism is that SQLite's type system lacks thedata integrity mechanism provided by statically typed columns, although it can be emulated with constraints likeCHECK(typeof(x)='integer').[12] In 2021, support for static typing was added through STRICT tables, which enforce datatype constraints for columns.[27]

Tables normally include a hiddenrowid index column, which provides faster access.[28] If a table includes an INTEGER PRIMARY KEY column, SQLite will typically optimize it by treating it as an alias for therowid, causing the contents to be stored as astrictly typed 64-bit signed integer and changing its behavior to be somewhat like an auto-incrementing column. SQLite includes an option to create a table without a rowid column, which can save disk space and improve lookup speed. WITHOUT ROWID tables are required to have a primary key.[29]

SQLite supports foreign key constraints,[30][31] although they are disabled by default and must be manually enabled with a PRAGMA statement.[32]

Stored procedures are not supported; this is an explicit choice by the developers to favor simplicity, as the typical use case of SQLite is to be embedded inside a host application that can define its own procedures around the database.[33]

SQLite does not have fullUnicode support by default for backwards compatibility and due to the size of the Unicode tables, which are larger than the SQLite library.[34] Full support forUnicode case-conversions can be enabled through an optional extension.[35]

SQLite supportsfull-text search through its FTS5 loadable extension, which allows users to efficiently search for a keyword in a large number of documents similar to howsearch engines search webpages.[36]

SQLite includes support for working withJSON through itsjson1 extension, which is enabled by default since 2021. SQLite's JSON functions can handle JSON5 syntax since 2023. In 2024, SQLite added support for JSONB, a binary serialization of SQLite's internal representation of JSON. Using JSONB allows applications to avoid having to parse the JSON text each time it is processed and saves a small amount of disk space.[37]

In May 2025, the 25th‑anniversary release SQLite 3.50.0 introduced additional features, including new Unicode functions (unistr() andunistr_quote()), a new API (sqlite3_setlk_timeout()) for setting lock timeouts, improved command‑line tools and rsync utility enhancements, and optimized JSONB.[38]

The maximum supported size for an SQLite database file is 281 terabytes.[39]

Development and distribution

[edit]

SQLite's code is hosted withFossil, adistributed version control system that uses SQLite as a local cache for its non-relational database format, and SQLite's SQL as an implementation language.[40][41]

SQLite ispublic domain, but not "open-contribution", with the website stating "the project does not accept patches from people who have not submitted anaffidavit dedicating their contribution into the public domain."[42] Instead of acode of conduct, the founders have adopted acode of ethics based on theRule of St. Benedict.[43]

A standalonecommand-lineshell program calledsqlite3[44] is provided in SQLite's distribution. It can be used to create a database, define tables, insert and change rows, run queries and manage an SQLite database file. It also serves as an example for writing applications that use the SQLite library.

SQLite uses automatedregression testing prior to each release. Over 2 million tests are run as part of a release's verification. The SQLite library has 156,000 lines of source code, while all the test suites combined add up to 92 million lines of test code. SQLite's tests simulate a number of exceptional scenarios, such as power loss and I/O errors, in addition to testing the library's functionality. Starting with the August 10, 2009 release of SQLite 3.6.17, SQLite releases have 100% branch test coverage, one of the components ofcode coverage. SQLite has four differenttest harnesses: the original public-domain TCL tests, the proprietary C-language TH3 test suite, the SQL Logic Tests, which check SQLite against other SQL databases, and the dbsqlfuzz proprietaryfuzzing engine.[45]

Notable uses

[edit]

Operating systems

[edit]

SQLite is included by default in:[13]

Middleware

[edit]
  • ADO.NET adapter, initially developed by Robert Simpson, is maintained jointly with the SQLite developers since April 2010.[47]
  • ODBC driver has been developed and is maintained separately by Christian Werner.[48] Werner's ODBC driver is the recommended connection method for accessing SQLite fromOpenOffice.org.[49]
  • COM (ActiveX) wrapper making SQLite accessible on Windows to scripted languages such asJScript andVBScript. This adds SQLite database capabilities toHTML Applications (HTA).[50]

Web browsers

[edit]
  • The browsersGoogle Chrome,Opera,Safari and theAndroid Browser all allow for storing information in, and retrieving it from, an SQLite database within the browser, using the official SQLite Wasm (WebAssembly) build,[51] or using theWeb SQL Database technology, although the latter is becoming deprecated (namely superseded by SQLite Wasm or byIndexedDB). Internally, theseChromium based browsers use SQLite databases for storing configuration data like site visit history, cookies, download history etc.[52]
  • Mozilla Firefox andMozilla Thunderbird store a variety of configuration data (bookmarks, cookies, contacts etc.) in internally managed SQLite databases. Until Firefox version 57 ("Firefox Quantum"), there was a third-party add-on that used the API supporting this functionality to provide a user interface for managing arbitrary SQLite databases.[53]
  • Several third-party add-ons can make use ofJavaScript APIs to manage SQLite databases.[54][55]

Web application frameworks

[edit]

Others

[edit]

See also

[edit]

Notes

[edit]
  1. ^SQLite's B-tree implementation was originally adapted fromThe Art of Computer Programming.[14]

References

[edit]

Citations

[edit]
  1. ^"SQLite Release 3.51.0 On 2025-11-04". 4 November 2025. Retrieved5 November 2025.
  2. ^"SQLite Copyright". sqlite.org. RetrievedMay 17, 2010.
  3. ^"SQLite database file format media type at IANA".Internet Assigned Numbers Authority.IANA. Retrieved2019-03-08.
  4. ^"Why SQLite succeeded as a database — Richard Hipp, creator of SQLite".The Changelog. Episode 201. Event occurs at 00:16:00.Archived from the original on 2022-07-07. Retrieved2025-04-11.How do I pronounce the name of the product? I say S-Q-L-ite, like a mineral.
  5. ^D. Richard Hipp (presenter) (May 31, 2006).An Introduction to SQLite(video). Google Inc. Event occurs at 00:01:14. RetrievedMarch 23, 2010.[ˌɛsˌkjuˌwəlˈaɪt̚]
  6. ^D. Richard Hipp (presenter) (May 31, 2006).An Introduction to SQLite. Google Inc. Event occurs at 00:48:15. RetrievedMarch 23, 2010.[ˈsikwəˌlaɪt̚]
  7. ^"Most Widely Deployed SQL Database Estimates". SQLite.org. RetrievedMay 11, 2011.
  8. ^Owens, Michael (2006)."Chapter 4: SQL". In Gilmore, Jason;Thomas, Keir (eds.).The Definitive Guide to SQLite.D. Richard Hipp (foreword), Preston Hagar (technical reviewer).Apress. p. 133.ISBN 978-1-59059-673-9.Archived from the original on 24 November 2020. Retrieved30 December 2014.
  9. ^"STRICT Tables".Archived from the original on 2022-08-07. Retrieved2022-08-11.
  10. ^"Full-Featured SQL".SQLite. RetrievedJanuary 24, 2025.
  11. ^"SQL Features That SQLite Does Not Implement".SQLite. RetrievedJanuary 24, 2025.
  12. ^abOwens, Michael (2006). "Introducing SQLite".The Definitive Guide to SQLite.Apress. pp. 1–16.doi:10.1007/978-1-4302-0172-4_1.ISBN 978-1-59059-673-9.
  13. ^abcdefghij"Well-Known Users Of SQLite". SQLite.Archived from the original on July 11, 2015. RetrievedAugust 5, 2015.
  14. ^Bell, Adam."The Untold Story of SQLite".Corecursive. Retrieved16 November 2025.
  15. ^"Interview: Richard Hipp on UnQL, a New Query Language for Document Databases". InfoQ. August 4, 2011.Archived from the original on April 8, 2014. RetrievedOctober 5, 2011.
  16. ^"LoC Recommended Storage Format".sqlite.org.Archived from the original on 2020-04-23. Retrieved2020-04-09.
  17. ^"SQLite, Version 3".www.loc.gov. 2017-03-28.Archived from the original on 2020-05-11. Retrieved2020-04-09.
  18. ^"Recommended Formats Statement – datasets/databases". Library of Congress.Archived from the original on 2018-08-22. Retrieved2020-04-09.
  19. ^"SQLite Is A Zero-Configuration Database". SQLite.org.Archived from the original on May 2, 2024. RetrievedAugust 3, 2015.
  20. ^ab"SQLite".ClickHouse Docs. RetrievedJanuary 25, 2025.
  21. ^"Write Ahead Logging in SQLite 3.7". SQLite.org.Archived from the original on May 2, 2024. RetrievedSeptember 3, 2011.WAL provides more concurrency as readers do not block writers and a writer does not block readers. Reading and writing can proceed concurrently.
  22. ^"Appropriate Uses For SQLite". SQLite.org.Archived from the original on 2024-05-02. Retrieved2015-09-03.
  23. ^Berkus, Josh (4 June 2014)."PGCon 2014: Clustering and VODKA".Lwn.net.Archived from the original on 2015-06-29. Retrieved2017-01-06.
  24. ^"PGCon2014: SQLite: Protégé of PostgreSQL".Pgcon.org. 20 September 2015.Archived from the original on 2014-12-30. Retrieved2017-01-06.
  25. ^"SQLite: StrictMode".Sqlite.org.Archived from the original on March 4, 2016. RetrievedSeptember 3, 2015.
  26. ^"Release History of SQLite".Archived from the original on 2021-03-16. Retrieved2021-03-22.
  27. ^"STRICT Tables".SQLite. RetrievedJanuary 24, 2025.
  28. ^"SQL As Understood By SQLite".SQLite.Archived from the original on 21 May 2018. Retrieved21 May 2018.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.
  29. ^"Clustered Indexes and the WITHOUT ROWID Optimization".SQLite. RetrievedJanuary 24, 2025.
  30. ^Karwin, Bill (May 2010). Carter, Jacquelyn (ed.).SQL Antipatterns: Avoiding the Pitfalls of Database Programming. The Pragmatic Bookshelf. p. 70.ISBN 978-1-934356-55-5.Sometimes you're forced to use a database brand that doesn't support foreign key constraints (for example MySQL's MyISAM storage engine or SQLite prior to version 3.6.19).
  31. ^"SQLite Release 3.6.19 On 2009-10-14".sqlite.org.Archived from the original on 2020-10-29. Retrieved2020-10-15.
  32. ^"SQLite Foreign Key Support".SQLite. RetrievedJanuary 24, 2025.
  33. ^Source: developers' comments onSQLite forumArchived 2023-04-01 at theWayback Machine
  34. ^"Quirks, Caveats, and Gotchas In SQLite".SQLite. RetrievedJanuary 24, 2025.
  35. ^"Case-insensitive matching of Unicode characters does not work".SQLite Frequently Asked Questions.Archived from the original on 2015-09-05. Retrieved2015-09-03.
  36. ^"SQLite FTS5 Extension".SQLite. RetrievedJanuary 24, 2025.
  37. ^"JSON Functions And Operators".SQLite. RetrievedJanuary 24, 2025.
  38. ^"SQLite Release 3.50.0 On 2025-05-29".SQLite. RetrievedNovember 3, 2025.
  39. ^"Limits In SQLite".SQLite.org.Archived from the original on 2021-11-07. Retrieved2022-09-19.
  40. ^"Thoughts On The Design Of The Fossil DVCS". Fossil-scm.org. July 12, 2017.Archived from the original on October 13, 2022. RetrievedOctober 14, 2022.
  41. ^"Fossil: Fossil Performance". Fossil-scm.org. August 23, 2009.Archived from the original on October 9, 2009. RetrievedSeptember 12, 2009.
  42. ^"SQLite Copyright".sqlite.org.Archived from the original on 2024-03-15. Retrieved2024-03-06.
  43. ^"Code Of Ethics".sqlite.org.Archived from the original on 2024-02-19. Retrieved2024-03-06.
  44. ^"Command Line Shell For SQLite". Sqlite.org.Archived from the original on October 6, 2022. RetrievedOctober 14, 2022.
  45. ^"How SQLite Is Tested". SQLite.org.Archived from the original on October 6, 2009. RetrievedSeptember 12, 2009.
  46. ^"To use the version of SQLite that is installed with Windows". 20 October 2022.Archived from the original on 31 March 2022. Retrieved31 March 2022.
  47. ^"Home".System.Data.SQLite. 2016-12-30.Archived from the original on 2014-07-13. Retrieved2017-01-06.
  48. ^"SQLite ODBC Driver".Ch-werner.de. 2016-12-01.Archived from the original on 2014-06-26. Retrieved2017-01-06.
  49. ^"Using SQLite Database with OpenOffice.org : Version 2.0"(PDF).Documentation.openoffice.org.Archived(PDF) from the original on 2011-09-28. Retrieved2017-01-06.
  50. ^"sqlite — Sqlite Wrappers". SQLite.org. February 7, 2009.Archived from the original on February 5, 2009. RetrievedFebruary 7, 2009.
  51. ^"sqlite3 WebAssembly & JavaScript Documentation Index".SQLite.Archived from the original on 2024-05-02. Retrieved2023-05-08.
  52. ^"Location of Google Chrome history".www.foxtonforensics.com. 2020-10-06.Archived from the original on 2023-02-28. Retrieved2020-10-06.
  53. ^"SQLite Manager :: Add-ons for Firefox".Addons.mozilla.org. 2015-02-28. Archived fromthe original on 2017-01-02. Retrieved2017-01-06.
  54. ^"SQLite Manager – Get this Extension for 🦊 Firefox (en-US)".Addons.mozilla.org. 2018-07-24.Archived from the original on 2018-10-05. Retrieved2018-10-05.
  55. ^"SQLite Reader – Get this Extension for 🦊 Firefox (en-US)".Addons.mozilla.org. 2018-09-01.Archived from the original on 2018-10-05. Retrieved2018-10-05.
  56. ^"Using SQL to find my best photo of a pelican according to Apple Photo".Simon Willison’s Weblog.Archived from the original on May 22, 2020. RetrievedMay 23, 2020.
  57. ^"Audacity 3.0.0 Released". 17 March 2021. Archived fromthe original on 14 August 2023. RetrievedMarch 17, 2021.
  58. ^Hinegardner, Jeremy (August 28, 2007)."Skype client using SQLite?".sqlite-users (Mailing list). Archived fromthe original on 2007-11-17. RetrievedJune 14, 2010.
  59. ^https://www.group-ib.com/blog/whatsapp-forensic-artifacts/. RetrievedSep 29, 2025.{{cite web}}:Missing or empty|title= (help)
  60. ^"Addendum: Project Years of Expenses With Quicken for Mac".The Frugal Vagabond.
  61. ^"sqlite3 — DB-API 2.0 interface for SQLite databases".The Python Standard Library Documentation.

Sources

[edit]

Further reading

[edit]

External links

[edit]
Wikimedia Commons has media related toSQLite.
Authority control databasesEdit this at Wikidata
Retrieved from "https://en.wikipedia.org/w/index.php?title=SQLite&oldid=1322860635"
Categories:
Hidden categories:

[8]ページ先頭

©2009-2025 Movatter.jp