All Products
Search
Document Center

PolarDB:PolarDB for AI

Last Updated:Jun 03, 2026

PolarDB for AI is a distributed machine learning component of PolarDB for MySQL with built-in AI models that you call through SQL to analyze data directly in PolarDB. PolarDB for AI also supports building custom models and loading external models with SQL statements, eliminating external data migration.

With PolarDB for AI, you can:

Use Qwen foundation models

Call built-in Qwen foundation models to run inference and interact with data in PolarDB. Choose a model based on your scenario.

Sentiment analysis model: Analyzes the sentiment of a sentence.

/*polar4ai*/SELECT * FROM PREDICT (MODEL _polar4ai_tongyi_sa, SELECT content FROM textinfo LIMIT 1) WITH ();
-- Query result from the textinfo table: This item only looks decent; the actual experience is very poor. I do not recommend purchasing it. 
Output: Negative

Chat model: Generates an answer based on a given prompt.

/*polar4ai*/SELECT * FROM PREDICT (MODEL _polar4ai_tongyi, SELECT 'Who are you') WITH ();
Output: I am a large language model created by Alibaba Cloud. My name is Qwen.

Summarization model: Generates a summary of an article.

/*polar4ai*/SELECT * FROM PREDICT (MODEL _polar4ai_tongyi_summarize, SELECT content FROM textinfo WHERE id = 3) WITH ();
-- Query result from the textinfo table: In recent years, the Chinese film market has gradually shifted towards realistic themes. In 2018, "Dying to Survive" became the summer box office champion with 3.1 billion in revenue. Subsequently, films such as "The White Storm 2: Drug Lords," "Raging Fire," and "Chinese Doctors" also achieved success. This summer, realistic films like "Lost in the Stars," "Octagonal," and "No More Bets" have been highly popular, reflecting the audience's interest in content that is close to real life.
Output: In recent years, the Chinese film market has favored realistic themes. In 2018, "Dying to Survive" topped the box office with 3.1 billion. Later, "The White Storm 2," "Raging Fire," and "Chinese Doctors" also achieved great success. This sum...

Translation model: Translates Chinese text into English.

/*polar4ai*/SELECT * FROM PREDICT (MODEL _polar4ai_tongyi_tran_2_en, SELECT content FROM textinfo ORDER BY id ASC LIMIT 1) WITH ();
-- Query result from the textinfo table: This item only looks decent; the actual experience is very poor. I do not recommend purchasing it. 
Output: This item only looks decent; the actual experience is very poor. I do not recommend purchasing it.

Benefits

End-to-end data intelligence: Manages the full lifecycle from model creation and evaluation to inference, eliminating cross-system data movement.

MySQL-compatible syntax: Use familiar SQL for machine learning operations (MLOps) with a minimal learning curve.

Built-in algorithm library: Includes machine learning and AI algorithms for classification, regression, clustering, and more.

Data protection: All data processing and model operations stay within the database for end-to-end security.

Prerequisites

Your cluster must meet the following requirements:

  • Region: Available only in Japan (Tokyo) and Singapore.

  • Database Edition is Enterprise Edition and Edition is Cluster Edition.

  • database engine version is MySQL 8.0.1 or later.

  • PolarProxy version is 2.7.5 or later.

You can view or upgrade the database engine version and PolarProxy version in Version management.

Billing

To use PolarDB for AI, you must create an AI node. The feature itself is free, but you are billed for the AI node at the same rates as standard compute nodes.

AI nodes also support two GPU specifications for model creation and inference:

  • 8 cores, 30 GB + one GU30 (polar.mysql.g8.2xlarge.gpu)

  • 16 cores, 125 GB + one GU100 (polar.mysql.x8.2xlarge.gpu)

Compute node billing rules are detailed in Compute nodes.

Get started

  1. Add an AI node and create a database account: Enable PolarDB for AI

    If you added an AI node during cluster creation, skip to creating a database account.
  2. Connect to the PolarDB cluster by using a cluster endpoint: Log on to PolarDB for AI

  3. Explore the built-in model: Use Qwen foundation models

  4. Advanced usage:

The complete model lifecycle is covered in Model usage workflow.