Here is a list of key concepts in EvaDB. If you have any questions, ask the community on Slack.

EvaQL: AI-Centric Query Language#

EvaDB supports a SQL-like query language, called EvaQL, designed to assist software developers in bringing AI into their applications.

Here is set of illustrative EvaQL queries for a ChatGPT-based video question answering app. This EvaDB app connects to collection of news videos stored in a folder and runs an AI query for extracting audio transcripts from the videos using a Hugging Face model, followed by another AI query for question answering using ChatGPT.

EvaQL reduces the complexity of the app, leading to more maintainable code that allows developers to build on top of each other’s queries. A single AI query can use multiple AI models to accomplish complicated tasks with minimal programming.

AI-Centric Query Optimization#

EvaDB optimizes the AI queries to save money spent on running models and reduce query execution time. It contains a novel Cascades-style extensible query optimizer tailored for AI queries. Query optimization has powered traditional SQL database systems for several decades. It is the bridge that connects the declarative query language to efficient query execution on hardware.

EvaDB accelerates AI queries using a collection of optimizations inspired by SQL database systems including cost-based function predicate reordering, function caching, sampling, etc.

AI Functions#

Functions are typically thin wrappers around AI models and are extensively used in queries. Here is an illustrative AI function for classifying MNIST images.

To register an user-defined function, use the CREATE FUNCTION statement:

--- Create an MNIST image classifier function
--- The function's implementation code is in ''
CREATE FUNCTION MnistImageClassifier
    IMPL ''

After registering MnistImageClassifier function, you can call the function in the SELECT and/or WHERE clauses of any query.

--- Get the output of 'MnistImageClassifier' on frame id 30
--- This query returns the results of the image classification function
--- In this case, it is the digit in the 30th frame in the video
SELECT data, id, MnistImageClassifier(data).label
FROM MnistVideo
WHERE id = 30;

--- Use the 'MnistImageClassifier' function's output to filter frames
--- This query returns the frame ids of the frames with digit 6
--- We limit to the first five frames containing digit 6
SELECT data, id, MnistImageClassifier(data).label
FROM MnistVideo
WHERE MnistImageClassifier(data).label = '6'