ðïļ Database
PostgreSQL-compatible SQL database. 50Ã faster with lock-free MVCC.
PostgreSQL Protocol
api.44s.io:5432
Use any PostgreSQL client or driver
HTTP API
api.44s.io:8600
REST API for SQL queries
Quick Start
Using psql
# Connect (use API key as password)
psql -h api.44s.io -p 5432 -U user -W
# Create a table
CREATE TABLE users (
id SERIAL PRIMARY KEY,
name VARCHAR(100) NOT NULL,
email VARCHAR(255) UNIQUE,
created_at TIMESTAMP DEFAULT NOW()
);
# Insert data
INSERT INTO users (name, email) VALUES
('Alice', 'alice@example.com'),
('Bob', 'bob@example.com');
# Query
SELECT * FROM users WHERE name LIKE 'A%';
# Update
UPDATE users SET name = 'Alice Smith' WHERE id = 1;
# Delete
DELETE FROM users WHERE id = 2;
Python
import psycopg2
# Connect
conn = psycopg2.connect(
host='api.44s.io',
port=5432,
user='user',
password='44s_your_api_key',
database='default'
)
cursor = conn.cursor()
# Create table
cursor.execute('''
CREATE TABLE IF NOT EXISTS products (
id SERIAL PRIMARY KEY,
name VARCHAR(100),
price DECIMAL(10,2),
stock INT
)
''')
# Insert
cursor.execute(
"INSERT INTO products (name, price, stock) VALUES (%s, %s, %s)",
('Widget', 29.99, 100)
)
# Query
cursor.execute("SELECT * FROM products WHERE price < %s", (50,))
for row in cursor.fetchall():
print(row)
conn.commit()
conn.close()
Node.js
const { Pool } = require('pg');
const pool = new Pool({
host: 'api.44s.io',
port: 5432,
user: 'user',
password: '44s_your_api_key',
database: 'default'
});
// Query
const result = await pool.query(
'SELECT * FROM users WHERE created_at > $1',
[new Date('2024-01-01')]
);
console.log(result.rows);
// Transaction
const client = await pool.connect();
try {
await client.query('BEGIN');
await client.query('UPDATE accounts SET balance = balance - $1 WHERE id = $2', [100, 1]);
await client.query('UPDATE accounts SET balance = balance + $1 WHERE id = $2', [100, 2]);
await client.query('COMMIT');
} catch (e) {
await client.query('ROLLBACK');
throw e;
} finally {
client.release();
}
HTTP API
Execute SQL over HTTP when you don't want to use PostgreSQL drivers.
POST
/sql
Execute a SQL statement
curl -X POST https://api.44s.io:8600/sql \
-H "Content-Type: application/json" \
-H "X-API-Key: 44s_your_api_key" \
-d '{"sql": "SELECT * FROM users LIMIT 10"}'
# Response
{
"success": true,
"columns": ["id", "name", "email", "created_at"],
"rows": [
{"id": 1, "name": "Alice", "email": "alice@example.com", "created_at": "2024-01-15T10:30:00Z"},
{"id": 2, "name": "Bob", "email": "bob@example.com", "created_at": "2024-01-15T11:00:00Z"}
],
"rows_affected": 2
}
GET
/tables
List all tables
curl https://api.44s.io:8600/tables \
-H "X-API-Key: 44s_your_api_key"
# Response
["users", "products", "orders"]
GET
/tables/{name}
Get table schema
GET
/stats
Get database statistics
Supported SQL
Data Definition
| Statement | Example |
|---|---|
CREATE TABLE | CREATE TABLE users (id INT PRIMARY KEY, name VARCHAR(100)) |
DROP TABLE | DROP TABLE users |
ALTER TABLE | ALTER TABLE users ADD COLUMN email VARCHAR(255) |
CREATE INDEX | CREATE INDEX idx_name ON users(name) |
Data Types
| Type | Description |
|---|---|
INT / INTEGER | 32-bit signed integer |
BIGINT | 64-bit signed integer |
SERIAL | Auto-incrementing integer |
FLOAT / REAL | 32-bit floating point |
DOUBLE | 64-bit floating point |
DECIMAL(p,s) | Exact numeric with precision |
VARCHAR(n) | Variable-length string |
TEXT | Unlimited text |
BOOLEAN | True/false |
TIMESTAMP | Date and time |
BYTEA | Binary data |
Queries
| Feature | Supported |
|---|---|
| SELECT with WHERE | â |
| JOINs (INNER, LEFT, RIGHT) | â |
| GROUP BY / HAVING | â |
| ORDER BY / LIMIT | â |
| Subqueries | â |
| Aggregate functions | â |
| DISTINCT | â |
Transactions
Full ACID transactions with MVCC (Multi-Version Concurrency Control):
BEGIN;
-- Multiple operations
UPDATE accounts SET balance = balance - 100 WHERE id = 1;
UPDATE accounts SET balance = balance + 100 WHERE id = 2;
INSERT INTO transfers (from_id, to_id, amount) VALUES (1, 2, 100);
-- Commit or rollback
COMMIT;
-- or ROLLBACK;
Performance
| Metric | 44s Database | PostgreSQL |
|---|---|---|
| Read throughput (96 cores) | 10M+ queries/sec | ~100K queries/sec |
| Write throughput | 1M+ writes/sec | ~10K writes/sec |
| Transaction latency | <100Ξs | ~1ms |
| Scaling | Linear with cores | Limited by locks |
Performance gains from lock-free B+Tree indexes and MVCC implementation.