Skip to content
trendoviz

Google Cloud adds ai.classify and ai.extract SQL functions to AlloyDB

Google Cloud previewed two new AI‑powered SQL functions, ai.classify and ai.extract, that enable text classification and structured data extraction directly within AlloyDB’s PostgreSQL engine.

Published

Overview

The preview introduces ai.classify and ai.extract as built‑in SQL functions accessible via the google_ml_integration extension (v1.6.1+) on PostgreSQL 18. ai.classify lets users define categories and choose single‑ or multi‑label output, while ai.extract converts free‑form text into JSON that matches a supplied schema. Both functions accept single rows, arrays, or REFCURSOR inputs and can be used in WHERE‑clause expressions, where AlloyDB automatically micro‑batches calls to Gemini Enterprise Agent Platform models.

Why it matters

Running classification and extraction directly inside the database removes the need for external service calls, reducing round‑trip latency, simplifying application code, and keeping sensitive data within the trusted cloud boundary. This can streamline pipelines that transform raw text into structured records for analytics or downstream processing.

Context

Operational databases such as AlloyDB store large volumes of unstructured text (e.g., clinical notes, invoices, support tickets). Traditionally, extracting meaning from this text requires exporting data, invoking external LLM endpoints, handling prompt construction, parsing responses, and managing retries—steps that add latency, code complexity, and compliance exposure.

Known, claimed, inferred

AlloyDB now supports two AI‑augmented SQL functions that operate on PostgreSQL 18 via an extension, offering row, array, and cursor execution with automatic micro‑batching to Gemini models. Google positions these capabilities as a way to reduce application complexity, latency, token spend, and compliance risk. While the preview outlines practical use cases across healthcare, finance, legal, and real‑estate domains, the lack of third‑party validation means organizations must evaluate accuracy, cost, and scalability themselves before production adoption.

Opportunities

Developers can build document‑processing pipelines that populate PostgreSQL Property Graph structures, automate categorisation of customer feedback, or create compliance‑focused tools that extract regulated fields without leaving the database. The schema‑driven JSON output of ai.extract also provides a clean preprocessing layer for search, reporting, or machine‑learning workflows. Planned enhancements hint at broader cost‑optimization and provenance features that could further expand in‑database AI use cases.

Risks

The functions are in preview, with no public pricing, regional availability, quota limits, or GA timeline. Model versions and parameters are unspecified, preventing assessment of reproducibility or bias. No independent benchmarks or accuracy metrics are available, so performance and cost‑benefit claims rely solely on Google's statements. Deploying inference inside AlloyDB also creates tighter coupling to Google Cloud services, which may affect vendor lock‑in considerations.

Limitations & uncertainties

The announcement is the sole source of information; no third‑party tests, benchmarks, or pricing details are provided. Quantitative data on inference speed, token savings, or query latency are absent. Model specifics, error rates, and compliance certifications are not disclosed. Example SQL queries are placeholders, preventing verification of exact syntax or result formats. Planned future features have no release schedule.

Evidence & sources

Updates & corrections

  1. First published

Found an error? Report it.