MyScaleDB
AI Database for unified, scalable SQL + vector management, search and analytics
Install / Use
/learn @OriginHubAI/MyScaleDBREADME
OriginHub MyScaleDB
<div align="center"> <img src="docs/assets/originhub-myscale4.png" alt="MyScale"> </div>🤔 What is MyScaleDB
MyScaleDB is the SQL vector database that enables developers to build production-ready and scalable AI applications using familiar SQL. It is built on top of ClickHouse and optimized for AI applications and solutions, allowing developers to effectively manage and process massive volumes of data.
✨ Key benefits of using MyScaleDB include:
- 🧩 Fully SQL-Compatible
- Fast, powerful, and efficient vector search, filtered search, and SQL-vector join queries.
- Use SQL with vector-related functions to interact with MyScaleDB. No need to learn complex new tools or frameworks – stick with what you know and love.
- 🤖 Production-Ready for AI applications
- A unified and time-tested platform to manage and process structured data, text, vector, JSON, geospatial, time-series data, and more. See supported data types and functions
- Improved RAG accuracy by combining vectors with rich metadata, full-text search, and performing high-precision, high-efficiency filtered search at any ratio.
- ⚡ Unmatched performance and scalability
- MyScaleDB leverages cutting-edge OLAP database architecture and advanced vector algorithms for lightning-fast vector operations.
- Scale your applications effortlessly and cost-effectively as your data grows.
❓ Why MyScaleDB
- Fully SQL compatible
- Unified structured and vectorized data management
- Millisecond search on billion-scale vectors
- Highly reliable & linearly scalable
- Powerful text-search and text/vector hybrid search functions
- Complex SQL vector queries
- LLM observability with MyScale Telemetry
MyScaleDB unifies three systems:
✅ SQL database/data warehouse
✅ Vector database
✅ Full-text search engine
It not only saves infrastructure and maintenance costs, but enables joint data queries and analytics as well.
<p align="center"> <img src="docs/assets/myscale-all-in-one.png" width=500 alt="MyScale Architecture"> </p>👉 See our documentation for more about MyScale’s unique features and advantages. Our open-source benchmark provides a detailed comparison with other vector database products.
❓ Why build on ClickHouse?
ClickHouse is a popular open-source analytical database that excels at big data processing and analytics due to its columnar storage with advanced compression, skip indexing, and SIMD processing. Unlike transactional databases like PostgreSQL and MySQL, which use row storage and main optimizers for transactional processing, ClickHouse has significantly faster analytical and data scanning speeds.
🚀 One of the key operations in combining structured and vector search is filtered search, which involves filtering by other attributes first and then performing vector search on the remaining data. Columnar storage and pre-filtering are crucial for ensuring high accuracy and high performance in filtered search, which is why we chose to build MyScaleDB on top of ClickHouse.
💡 We've contributed many enhancements related to general SQL processing back to ClickHouse to ensure fast and cost-effective SQL vector queries: #37893 #38048 #37859 #56728 #58223
🖥️ Self-Hosted
Using MyScaleDB Docker Image
To quickly get a MyScaleDB instance up and running, get the docker image:
docker pull origin-hub-ai-registry.cn-shanghai.cr.aliyuncs.com/aidb-public/myscaledb:2.1.0
docker run -v /etc/clickhouse/data:/container/data --name myscaledb --net=host origin-hub-ai-registry.cn-shanghai.cr.aliyuncs.com/aidb-public/myscaledb:2.1.0
Note: Myscale's default configuration only allows localhost ip access. For the docker run startup method, you need to specify
--net=hostto access services deployed in docker mode on the current node.
This will start a MyScaleDB instance with default user default and no password. You can then connect to the database using clickhouse-client:
docker exec -it myscaledb clickhouse-client
Using Docker Compose
- Use the following recommended directory structure and the location of the
docker-compose.yamlfile:
> tree myscaledb
myscaledb
├── docker-compose.yaml
└── volumes
└── config
└── users.d
└── custom_users_config.xml
3 directories, 2 files
- Define the configuration for your deployment. We recommend starting with the following configuration in your
docker-compose.yamlfile, which you can adjust based on your specific requirements:
version: '3.7'
services:
myscaledb:
image: origin-hub-ai-registry.cn-shanghai.cr.aliyuncs.com/aidb-public/myscaledb:2.1.0
tty: true
ports:
- '8123:8123'
- '9000:9000'
- '8998:8998'
- '9363:9363'
- '9116:9116'
networks:
myscaledb_network:
ipv4_address: 10.0.0.2
volumes:
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/data:/var/lib/clickhouse
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/log:/var/log/clickhouse-server
- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/config/users.d/custom_users_config.xml:/etc/clickhouse-server/users.d/custom_users_config.xml
deploy:
resources:
limits:
cpus: "16.00"
memory: 32Gb
networks:
myscaledb_network:
driver: bridge
ipam:
driver: default
config:
- subnet: 10.0.0.0/24
custom_users_config.xml:
<clickhouse>
<users>
<default>
<password></password>
<networks>
<ip>::1</ip>
<ip>127.0.0.1</ip>
<ip>10.0.0.0/24</ip>
</networks>
<profile>default</profile>
<quota>default</quota>
<access_management>1</access_management>
</default>
</users>
</clickhouse>
Note: The custom_users_config configuration allows you to use the default user to access the database on the node where the database service is deployed using docker compose. If you want to access the database service on other nodes, it is recommended to create a user that can be accessed through other IPs. For detailed settings, see: MyScaleDB Create User.
You can also customize the configuration file of MyScaleDB. Copy the
/etc/clickhouse-serverdirectory from yourmyscaledbcontainer to your local drive, modify the configuration, and add a directory mapping to thedocker-compose.yamlfile to make the configuration take effect:- ${DOCKER_VOLUME_DIRECTORY:-.}/volumes/config:/etc/clickhouse-server
- Use the following command to get it running:
cd myscaledb
docker compose up -d
- Access the MyScaleDB command line interface using the following command.
docker exec -it myscaledb-myscaledb-1 clickhouse-client
- You can now run SQL statements. See Executing SQL Queries.
🔨 Building from Source
The supported build environment is Ubuntu 22.04 with LLVM 15.0.7.
Please see the scripts folder.
Example usage:
LLVM_VERSION=15 sudo -E bash scripts/install_deps.sh
sudo apt-get -y install rustc cargo yasm
bash scripts/config_on_linux.sh
bash scripts/build_on_linux.sh
The resulting executables will be in MyScaleDB/build/programs/*.
📚 Tutorial
See Vector Search Documentation for how to create a SQL table with vector index and perform vector search. It's recommended to specify TYPE SCANN when creating a vector index in open source MyScaleDB.
1️⃣ Create a Table with Vector Column
-- Create a table with body_vector of length 384
CREATE TABLE default.wiki_abstract
(
`id` UInt64,
`body` String,
`title` String,
`url` String,
`body_vector` Array(Float32),
CONSTRAINT check_length CHECK length(body_vector) = 384
)
ENGINE = MergeTree
ORDER BY id;
2️⃣ Insert Data to Your Table
-- Insert data from parquet files on S3
INSERT INTO default.wiki_abstract SELECT * FROM s3('https://myscale-datasets.s3.ap-southeast-1.amazonaws.com/wiki_abstract_with_vector.parquet','Parquet');
3️⃣ Create the Vector Index
-- Build a SCANN vector index with Cosine metric on the body_vector
ALTER TABLE default.wiki_abstract ADD VECTOR INDEX vec_idx body_vector TYPE SCANN('metric_type=Cosine');
-- Query the index build progress from the `vector_indices` table
-- Wait until the index progress becomes `Built`
SELECT * FROM system.vector_indices;
4️⃣ Execute Vector Search
-- Perform vector search return the top-5 results
SELECT
id,
title,
distance(body_vector, [-0.052, -0.0146, -0.0677, -0.0256, -0.0395, -0.0381, -0.025, 0.0911, -0.0429, -0.0592, 0.0017, -0.0358, -0.0464, -0.0189, -0.0192, 0.0544, -0.0022, -0.0292, -0.0474, -0.0286, 0.0746, -0.
Related Skills
feishu-drive
339.5k|
things-mac
339.5kManage Things 3 via the `things` CLI on macOS (add/update projects+todos via URL scheme; read/search/list from the local Things database)
clawhub
339.5kUse the ClawHub CLI to search, install, update, and publish agent skills from clawhub.com
yu-ai-agent
2.0k编程导航 2025 年 AI 开发实战新项目,基于 Spring Boot 3 + Java 21 + Spring AI 构建 AI 恋爱大师应用和 ReAct 模式自主规划智能体YuManus,覆盖 AI 大模型接入、Spring AI 核心特性、Prompt 工程和优化、RAG 检索增强、向量数据库、Tool Calling 工具调用、MCP 模型上下文协议、AI Agent 开发(Manas Java 实现)、Cursor AI 工具等核心知识。用一套教程将程序员必知必会的 AI 技术一网打尽,帮你成为 AI 时代企业的香饽饽,给你的简历和求职大幅增加竞争力。
