Dataset Viewer
Auto-converted to Parquet Duplicate
h1
stringclasses
12 values
h2
stringclasses
93 values
h3
stringlengths
0
64
h5
stringlengths
0
79
content
stringlengths
24
533k
tokens
int64
7
158k
content_embeddings_openai_text_embedding_3_small_512
sequencelengths
512
512
content_embeddings_potion_base_8M_256
sequencelengths
256
256
Summary
This document contains [DuckDB's official documentation and guides](https://duckdb.org/) in a single-file easy-to-search form. If you find any issues, please report them [as a GitHub issue](https://github.com/duckdb/duckdb-web/issues). Contributions are very welcome in the form of [pull requests](https://github.com/duckdb/duckdb-web/pulls). If you are considering submitting a contribution to the documentation, please consult our [contributor guide](https://github.com/duckdb/duckdb-web/blob/main/CONTRIBUTING.md). Code repositories: * DuckDB source code: [github.com/duckdb/duckdb](https://github.com/duckdb/duckdb) * DuckDB documentation source code: [github.com/duckdb/duckdb-web](https://github.com/duckdb/duckdb-web)
184
[ 0.11890102177858353, 0.01533113420009613, -0.01635786145925522, 0.02390380948781967, 0.0552239827811718, -0.0536290667951107, 0.0549049973487854, 0.024422157555818558, 0.00978381559252739, -0.02972525544464588, 0.050518978387117386, 0.0003144664515275508, -0.01877017319202423, -0.031838521...
[ -0.10126056522130966, 0.08506700396537781, -0.06488365679979324, -0.09601891785860062, -0.08698877692222595, -0.025475014001131058, -0.10939063876867294, -0.08438839018344879, -0.13741590082645416, -0.006689759902656078, 0.030868330970406532, 0.07191573083400726, -0.028996339067816734, -0....
Connect
Connect
Connect or Create a Database
To use DuckDB, you must first create a connection to a database. The exact syntax varies between the [client APIs](#docs:api:overview) but it typically involves passing an argument to configure persistence.
43
[ 0.11890102177858353, 0.01533113420009613, -0.01635786145925522, 0.02390380948781967, 0.0552239827811718, -0.0536290667951107, 0.0549049973487854, 0.024422157555818558, 0.00978381559252739, -0.02972525544464588, 0.050518978387117386, 0.0003144664515275508, -0.01877017319202423, -0.031838521...
[ -0.10126056522130966, 0.08506700396537781, -0.06488365679979324, -0.09601891785860062, -0.08698877692222595, -0.025475014001131058, -0.10939063876867294, -0.08438839018344879, -0.13741590082645416, -0.006689759902656078, 0.030868330970406532, 0.07191573083400726, -0.028996339067816734, -0....
Connect
Connect
Persistence
DuckDB can operate in both persistent mode, where the data is saved to disk, and in in-memory mode, where the entire data set is stored in the main memory. > **Tip. ** Both persistent and in-memory databases use spilling to disk to facilitate larger-than-memory workloads (i.e., out-of-core-processing). #### Persistent Database {#docs:connect:overview::persistent-database} To create or open a persistent database, set the path of the database file, e.g., `my_database.duckdb`, when creating the connection. This path can point to an existing database or to a file that does not yet exist and DuckDB will open or create a database at that location as needed. The file may have an arbitrary extension, but `.db` or `.duckdb` are two common choices with `.ddb` also used sometimes. Starting with v0.10, DuckDB's storage format is [backwards-compatible](#docs:internals:storage::backward-compatibility), i.e., DuckDB is able to read database files produced by an older versions of DuckDB. For example, DuckDB v0.10 can read and operate on files created by the previous DuckDB version, v0.9. For more details on DuckDB's storage format, see the [storage page](#docs:internals:storage). #### In-Memory Database {#docs:connect:overview::in-memory-database} DuckDB can operate in in-memory mode. In most clients, this can be activated by passing the special value `:memory:` as the database file or omitting the database file argument. In in-memory mode, no data is persisted to disk, therefore, all data is lost when the process finishes.
362
[ 0.11890102177858353, 0.01533113420009613, -0.01635786145925522, 0.02390380948781967, 0.0552239827811718, -0.0536290667951107, 0.0549049973487854, 0.024422157555818558, 0.00978381559252739, -0.02972525544464588, 0.050518978387117386, 0.0003144664515275508, -0.01877017319202423, -0.031838521...
[ -0.10126056522130966, 0.08506700396537781, -0.06488365679979324, -0.09601891785860062, -0.08698877692222595, -0.025475014001131058, -0.10939063876867294, -0.08438839018344879, -0.13741590082645416, -0.006689759902656078, 0.030868330970406532, 0.07191573083400726, -0.028996339067816734, -0....
Connect
Concurrency
Handling Concurrency
DuckDB has two configurable options for concurrency: 1. One process can both read and write to the database. 2. Multiple processes can read from the database, but no processes can write ([`access_mode = 'READ_ONLY'`](#docs:configuration:overview::configuration-reference)). When using option 1, DuckDB supports multiple writer threads using a combination of [MVCC (Multi-Version Concurrency Control)](https://en.wikipedia.org/wiki/Multiversion_concurrency_control) and optimistic concurrency control (see [Concurrency within a Single Process](#::concurrency-within-a-single-process)), but all within that single writer process. The reason for this concurrency model is to allow for the caching of data in RAM for faster analytical queries, rather than going back and forth to disk during each query. It also allows the caching of functions pointers, the database catalog, and other items so that subsequent queries on the same connection are faster. > DuckDB is optimized for bulk operations, so executing many small transactions is not a primary design goal.
214
[ 0.11890102177858353, 0.01533113420009613, -0.01635786145925522, 0.02390380948781967, 0.0552239827811718, -0.0536290667951107, 0.0549049973487854, 0.024422157555818558, 0.00978381559252739, -0.02972525544464588, 0.050518978387117386, 0.0003144664515275508, -0.01877017319202423, -0.031838521...
[ -0.10126056522130966, 0.08506700396537781, -0.06488365679979324, -0.09601891785860062, -0.08698877692222595, -0.025475014001131058, -0.10939063876867294, -0.08438839018344879, -0.13741590082645416, -0.006689759902656078, 0.030868330970406532, 0.07191573083400726, -0.028996339067816734, -0....
Connect
Concurrency
Concurrency within a Single Process
DuckDB supports concurrency within a single process according to the following rules. As long as there are no write conflicts, multiple concurrent writes will succeed. Appends will never conflict, even on the same table. Multiple threads can also simultaneously update separate tables or separate subsets of the same table. Optimistic concurrency control comes into play when two threads attempt to edit (update or delete) the same row at the same time. In that situation, the second thread to attempt the edit will fail with a conflict error.
102
[ 0.11890102177858353, 0.01533113420009613, -0.01635786145925522, 0.02390380948781967, 0.0552239827811718, -0.0536290667951107, 0.0549049973487854, 0.024422157555818558, 0.00978381559252739, -0.02972525544464588, 0.050518978387117386, 0.0003144664515275508, -0.01877017319202423, -0.031838521...
[ -0.10126056522130966, 0.08506700396537781, -0.06488365679979324, -0.09601891785860062, -0.08698877692222595, -0.025475014001131058, -0.10939063876867294, -0.08438839018344879, -0.13741590082645416, -0.006689759902656078, 0.030868330970406532, 0.07191573083400726, -0.028996339067816734, -0....
Connect
Concurrency
Writing to DuckDB from Multiple Processes
Writing to DuckDB from multiple processes is not supported automatically and is not a primary design goal (see [Handling Concurrency](#::handling-concurrency)). If multiple processes must write to the same file, several design patterns are possible, but would need to be implemented in application logic. For example, each process could acquire a cross-process mutex lock, then open the database in read/write mode and close it when the query is complete. Instead of using a mutex lock, each process could instead retry the connection if another process is already connected to the database (being sure to close the connection upon query completion). Another alternative would be to do multi-process transactions on a MySQL, PostgreSQL, or SQLite database, and use DuckDB's [MySQL](#docs:extensions:mysql), [PostgreSQL](#docs:extensions:postgres), or [SQLite](#docs:extensions:sqlite) extensions to execute analytical queries on that data periodically. Additional options include writing data to Parquet files and using DuckDB's ability to [read multiple Parquet files](#docs:data:parquet:overview), taking a similar approach with [CSV files](#docs:data:csv:overview), or creating a web server to receive requests and manage reads and writes to DuckDB.
254
[ 0.11890102177858353, 0.01533113420009613, -0.01635786145925522, 0.02390380948781967, 0.0552239827811718, -0.0536290667951107, 0.0549049973487854, 0.024422157555818558, 0.00978381559252739, -0.02972525544464588, 0.050518978387117386, 0.0003144664515275508, -0.01877017319202423, -0.031838521...
[ -0.10126056522130966, 0.08506700396537781, -0.06488365679979324, -0.09601891785860062, -0.08698877692222595, -0.025475014001131058, -0.10939063876867294, -0.08438839018344879, -0.13741590082645416, -0.006689759902656078, 0.030868330970406532, 0.07191573083400726, -0.028996339067816734, -0....
Connect
Concurrency
Optimistic Concurrency Control
DuckDB uses [optimistic concurrency control](https://en.wikipedia.org/wiki/Optimistic_concurrency_control), an approach generally considered to be the best fit for read-intensive analytical database systems as it speeds up read query processing. As a result any transactions that modify the same rows at the same time will cause a transaction conflict error: ```console Transaction conflict: cannot update a table that has been altered! ``` > **Tip. ** A common workaround when a transaction conflict is encountered is to rerun the transaction.
108
[ 0.11890102177858353, 0.01533113420009613, -0.01635786145925522, 0.02390380948781967, 0.0552239827811718, -0.0536290667951107, 0.0549049973487854, 0.024422157555818558, 0.00978381559252739, -0.02972525544464588, 0.050518978387117386, 0.0003144664515275508, -0.01877017319202423, -0.031838521...
[ -0.10126056522130966, 0.08506700396537781, -0.06488365679979324, -0.09601891785860062, -0.08698877692222595, -0.025475014001131058, -0.10939063876867294, -0.08438839018344879, -0.13741590082645416, -0.006689759902656078, 0.030868330970406532, 0.07191573083400726, -0.028996339067816734, -0....
Data Import
Importing Data
The first step to using a database system is to insert data into that system. DuckDB provides can directly connect to [many popular data sources](#docs:data:data_sources) and offers several data ingestion methods that allow you to easily and efficiently fill up the database. On this page, we provide an overview of these methods so you can select which one is best suited for your use case.
79
[ 0.11890102177858353, 0.01533113420009613, -0.01635786145925522, 0.02390380948781967, 0.0552239827811718, -0.0536290667951107, 0.0549049973487854, 0.024422157555818558, 0.00978381559252739, -0.02972525544464588, 0.050518978387117386, 0.0003144664515275508, -0.01877017319202423, -0.031838521...
[ -0.10126056522130966, 0.08506700396537781, -0.06488365679979324, -0.09601891785860062, -0.08698877692222595, -0.025475014001131058, -0.10939063876867294, -0.08438839018344879, -0.13741590082645416, -0.006689759902656078, 0.030868330970406532, 0.07191573083400726, -0.028996339067816734, -0....
Data Import
Importing Data
`INSERT` Statements
`INSERT` statements are the standard way of loading data into a database system. They are suitable for quick prototyping, but should be avoided for bulk loading as they have significant per-row overhead. ```sql INSERT INTO people VALUES (1, 'Mark'); ``` For a more detailed description, see the [page on the `INSERT statement`](#docs:data:insert).
77
[ 0.11890102177858353, 0.01533113420009613, -0.01635786145925522, 0.02390380948781967, 0.0552239827811718, -0.0536290667951107, 0.0549049973487854, 0.024422157555818558, 0.00978381559252739, -0.02972525544464588, 0.050518978387117386, 0.0003144664515275508, -0.01877017319202423, -0.031838521...
[ -0.10126056522130966, 0.08506700396537781, -0.06488365679979324, -0.09601891785860062, -0.08698877692222595, -0.025475014001131058, -0.10939063876867294, -0.08438839018344879, -0.13741590082645416, -0.006689759902656078, 0.030868330970406532, 0.07191573083400726, -0.028996339067816734, -0....
Data Import
Importing Data
CSV Loading
Data can be efficiently loaded from CSV files using several methods. The simplest is to use the CSV file's name: ```sql SELECT * FROM 'test.csv'; ``` Alternatively, use the [`read_csv` function](#docs:data:csv:overview) to pass along options: ```sql SELECT * FROM read_csv('test.csv', header = false); ``` Or use the [`COPY` statement](#docs:sql:statements:copy::copy--from): ```sql COPY tbl FROM 'test.csv' (HEADER false); ``` It is also possible to read data directly from **compressed CSV files** (e.g., compressed with [gzip](https://www.gzip.org/)): ```sql SELECT * FROM 'test.csv.gz'; ``` DuckDB can create a table from the loaded data using the [`CREATE TABLE ... AS SELECT` statement](#docs:sql:statements:create_table::create-table--as-select-ctas): ```sql CREATE TABLE test AS SELECT * FROM 'test.csv'; ``` For more details, see the [page on CSV loading](#docs:data:csv:overview).
239
[ 0.11890102177858353, 0.01533113420009613, -0.01635786145925522, 0.02390380948781967, 0.0552239827811718, -0.0536290667951107, 0.0549049973487854, 0.024422157555818558, 0.00978381559252739, -0.02972525544464588, 0.050518978387117386, 0.0003144664515275508, -0.01877017319202423, -0.031838521...
[ -0.10126056522130966, 0.08506700396537781, -0.06488365679979324, -0.09601891785860062, -0.08698877692222595, -0.025475014001131058, -0.10939063876867294, -0.08438839018344879, -0.13741590082645416, -0.006689759902656078, 0.030868330970406532, 0.07191573083400726, -0.028996339067816734, -0....
Data Import
Importing Data
Parquet Loading
Parquet files can be efficiently loaded and queried using their filename: ```sql SELECT * FROM 'test.parquet'; ``` Alternatively, use the [`read_parquet` function](#docs:data:parquet:overview): ```sql SELECT * FROM read_parquet('test.parquet'); ``` Or use the [`COPY` statement](#docs:sql:statements:copy::copy--from): ```sql COPY tbl FROM 'test.parquet'; ``` For more details, see the [page on Parquet loading](#docs:data:parquet:overview).
121
[ 0.11890102177858353, 0.01533113420009613, -0.01635786145925522, 0.02390380948781967, 0.0552239827811718, -0.0536290667951107, 0.0549049973487854, 0.024422157555818558, 0.00978381559252739, -0.02972525544464588, 0.050518978387117386, 0.0003144664515275508, -0.01877017319202423, -0.031838521...
[ -0.10126056522130966, 0.08506700396537781, -0.06488365679979324, -0.09601891785860062, -0.08698877692222595, -0.025475014001131058, -0.10939063876867294, -0.08438839018344879, -0.13741590082645416, -0.006689759902656078, 0.030868330970406532, 0.07191573083400726, -0.028996339067816734, -0....
End of preview. Expand in Data Studio

No dataset card yet

Downloads last month
17