SQL Database
Create relational databases on Azion, run SQL statements against them from the API, a function, or Azion Console, and rank rows by vector distance.
A relational database holds records in tables of rows and columns, where each column carries one kind of value and each row is one record. SQL is the language that reads and changes those records: a statement describes the rows you want, and the database finds them. As a managed service, a database is created by a request instead of installed, so there is no server to provision, no engine to patch, and no replication to set up.
SQL Database runs those databases on Azion’s distributed infrastructure. A database is an object you create by name, and every statement is addressed to one of them. The databases are fully ACID-compliant and the dialect is SQLite’s, so a statement you already write runs unchanged. One main instance takes every write, and read replicas answer the reads. Use SQL Database to store telemetry from IoT devices, track inventory across distributed ecommerce centers, analyze access logs for security attacks, or manage access data.
Quickstart SQL Database guidesStatements and results
SQL reaches a database through one endpoint, which takes an array of SQL strings and returns one entry per string:
The response carries the columns, the rows, and what the statement cost:
statementsholds one or more SQL strings.CREATE TABLE,INSERT, andSELECTare all strings in that one array, so a single call mixes schema changes, writes, and reads.columnsandrowscarry the result set. Each entry ofrowsis one row, with its values in column order.rows_readandrows_writtenare the two metrics Azion bills on, and every statement reports its own.- A statement that fails still answers HTTP
200, and its entry carrieserrorin place ofresults. Readdata[].errorbefore you readdata[].results.
If you know SQLite, you know the dialect: the strings inside the array are ordinary SQL. For the statements the engine accepts, refer to the SQLite language reference.
Statement path
A statement that fails does not fail the request. The call answers HTTP 200 whether every statement succeeded or one of them did not, so the status line describes the request and never the SQL inside it.
- You create a database with
POST /databasesand aname. It answers statements once itsstatusreadscreated, about 15 seconds later. - Five interfaces send statements to the query endpoint of that database: Azion Console, the Azion API, the
azionlibrary, theazion:sqlmodule inside a function, and the EdgeSQL Shell. - The
statementsarray runs in the order it lists, and at least 100 statements in one call succeed. - A statement that writes is applied to the main instance, while a read is answered from a read replica, so nothing writes to a replica directly.
- Each statement returns one entry in
data, carryingresultswithcolumns,rows,rows_read,rows_written, andquery_duration_ms. - A statement that failed carries
errorin that entry instead, and the entries around it still carry their results.
For the instances, the lifecycle of a database, and what a statement costs, refer to How SQL Database works.
What SQL Database covers
- Interfaces. Azion Console, the Azion API v4, the
azionlibrary for Node and TypeScript, theazion:sqlmodule inside a function, and the EdgeSQL Shell, a command-line tool. All five reach the same databases. - SQL dialect. SQLite’s, which is why an existing schema and an existing query transfer. The vector types and vector functions extend it, and nothing else does.
- Availability. SQL Database is a Preview product on every service plan. It is not enabled on an account by default, and access is requested through a support ticket. To request it, refer to Technical Support.
- Bounds. A database name is 6 to 50 characters of letters, numbers, and the hyphen, and it is unique across the account. A table holds up to 2,000 columns, a vector carries up to 65,536 dimensions, and one list request returns up to 100 databases. The number of databases, the size of each one, and the storage per account are included per plan. For every bound and what happens past it, refer to SQL Database limits.
- Recommendations and failures. Best practices covers reading the error key of every statement, polling a new database before the first query, and indexing a vector column before the first nearest-neighbor query. When a create request is rejected, a statement returns
error, or the EdgeSQL Shell exits at startup, refer to Troubleshooting. - What it does not do. SQL Database stores relational records, so unstructured files belong in Object Storage and key-value pairs in KV Store. A database cannot be renamed, and
activecannot be changed after creation:PATCHandPUTanswer405. Azion CLI carries no SQL command, and the Azion Terraform provider publishes no SQL resource.
Vector search
A vector column holds an embedding, the numeric representation of a text, an image, or another value, in the same table as the ordinary columns. One statement therefore filters on a WHERE clause and ranks by vector distance, and no separate service holds a second copy of the data.
The column is declared as a blob type carrying its dimension count, an index marks it for approximate nearest-neighbor search, and vector_top_k returns the closest rows:
This is what the retrieval step of a retrieval-augmented generation (RAG) application reads from: AI Inference serves the model, and the database serves the rows that ground it. For the column types, the distance functions, the index, and the bounds, refer to Vector search.