Oracle Vectors and Similarity Search for Christmas
As the holiday season approaches, many of us find ourselves searching for the perfect playlist, gift recommendations, family photos, or recipes that capture the right feeling. But, how can one do those kinds of “feeling searches”? The “feeling” can be captured by a vector embedding, and these vector embeddings can be compared to each other using a similarity search to find similar feelings.
The Oracle AI Database supports vector embeddings and similarity search natively. These capabilities allow applications to move beyond exact matches and rigid rules, and instead find content based on semantic or perceptual similarity.
What is a vector embedding?
A vector embedding is a numerical representation of the essential characteristics of text, images, audio, or any other data in a form that machines can compare mathematically. Items that are similar will have embeddings that are numerically close to each other. For example, you can compare two classical Christmas songs, two red Nordic-style sweaters, or two warmly lit living-room photos.
How does it work in an Oracle Database?
Oracle Database 23ai introduced a native VECTOR data type, vector indexes for an efficient approximate similarity search, and built-in SQL functions for generating vector embeddings (VECTOR_EMBEDDING), distance functions (VECTOR_DISTANCE, and its equivalents of different distance metrics, for example COSINE_DISTANCE and L1_DISTANCE) for comparing the vector embeddings, as well as several PL/SQL packages for advanced operations with vectors (DBMS_VECTOR, DBMS_VECTOR_CHAIN, DBMS_HYBRID_VECTOR).
Let’s see a couple of examples of how they work.
Example 1: Building the Ideal Christmas Playlist
Suppose a table CHRISTMAS_SONGS contains a column EMBEDDING of type VECTOR for each track. To find songs that are most similar to Michael Bublé’s “It’s Beginning to Look A Lot Like Christmas”:
SELECT song_name, artist, year
FROM christmas_songs
ORDER BY VECTOR_DISTANCE(
embedding,
(SELECT embedding FROM christmas_songs
WHERE song_name = 'It’s Beginning to Look a Lot Like Christmas')
)
FETCH FIRST 20 ROWS ONLY;
The result naturally surfaces songs by Bing Crosby, Dean Martin, Frank Sinatra, and Ella Fitzgerald, all sharing the same warm, crooner-era holiday atmosphere, without any explicit genre or year filters, and returning the 20 closest songs to Michael Bublé’s Christmas classic.
Example 2: Intelligent Christmas Gift Recommendations
An e-commerce table GIFT_CATALOG stores product data, including their images. The IMAGE_EMBEDDING column stores the vector embedding of each image.
After a customer purchases a hand-knitted Scandinavian reindeer sweater, the recommendation engine runs:
SELECT product_name, price, image_url
FROM gift_catalog
WHERE category = 'Christmas'
ORDER BY VECTOR_DISTANCE(image_embedding, :purchased_item_embedding)
FETCH FIRST 10 ROWS ONLY;
The system returns 10 visually and stylistically coherent suggestions of similar products as gift recommendations.
Example 3: Searching Family Christmas Photos by Mood
Let's say you have 10,000 family Christmas photos over the years. You want to find 50 pictures that “feel like” the one where everyone is wearing ugly sweaters around the tree in 2017. A personal photo archive table FAMILY_PHOTOS contains embeddings generated from each image. To retrieve 50 photos from the years 2000-2025 that feel like the iconic 2017 photo referred as :reference_photo_embedding, simply query:
SELECT photo_id, taken_date, thumbnail_url
FROM family_photos
WHERE EXTRACT(YEAR FROM taken_date) BETWEEN 2000 AND 2025
ORDER BY VECTOR_DISTANCE(photo_embedding, :reference_photo_embedding)
FETCH FIRST 50 ROWS ONLY;
The query instantly assembles a heartfelt montage of similar cozy, festive moments across decades.
Example 4: Finding Better Alternatives to Traditional Fruitcake
A recipe database stores text embeddings of ingredient lists and descriptions. A user searching for “something like Grandma’s rum-soaked fruitcake but less dense” can have their natural language query converted to an embedding and matched to the whole database to find the eight best-matching recipes:
SELECT recipe_name, rating
FROM holiday_recipes
ORDER BY VECTOR_DISTANCE(text_embedding, :query_embedding)
FETCH FIRST 8 ROWS ONLY;
Relevant, highly rated alternatives such as Jamaican black cake, German stollen, or panettone rise to the top.
Why This Matters
Traditional relational queries excel at precise conditions, for example, customer_no = 42, price < 50, color = red, rating ≥ 4. Vector similarity search excels at capturing nuance, mood, style, and intent.
Oracle has made the technology accessible and production-ready:
- Vectors live alongside regular columns in the same table
- Embeddings can be created either inside the database or outside of it
- Indexing and querying require only a few lines of SQL
- Performance scales to billions of vectors with reasonable response times
- Integration with existing security, backup, and high-availability features is seamless
- Integration with existing multimodal features of an Oracle Database is seamless
Conclusion
This holiday season, while we enjoy the lights, music, and traditions that feel just right, it’s worth noting that modern databases can now understand “feelings” in a surprisingly human way. Oracle’s vector capabilities bring semantic and perceptual search into the mainstream enterprise applications; no separate specialized engine required. Whether you’re curating the perfect Christmas playlist, recommending thoughtful gifts, rediscovering cherished memories, or rescuing dessert, vector similarity search delivers results that simply feel right.
To explore these features yourself, Oracle’s Always Free Autonomous AI Database includes full vector search support.
Happy holidays, and happy querying. 🎄
Heli Helskyaho
CEO, Miracle Finland Oy
CTO, Miracle SEA Consulting Pte. Ltd.
Oracle ACE Director

Ready to Take Your Oracle Skills to the Next Level?
Join OraPub, Viscosity’s training hub for Oracle professionals, packed with expert-led courses and exclusive paid member benefits.
Check out Viscosity’s event page for upcoming virtual and on-site training opportunities.

SUBMIT YOUR COMMENT