The GlobalSolutions

PostgreSQL with pgvector Powered by GlobalSolutions

PostgreSQL with pgvector is a powerful open-source vector database solution that adds native vector similarity search capabilities to PostgreSQL. Using the official pgvector extension, you can efficiently store and query high-dimensional vector embeddings (from OpenAI, Hugging Face, Cohere, and other models) directly inside your PostgreSQL tables.

It combines the reliability, ACID compliance, rich SQL features, and mature ecosystem of PostgreSQL with fast vector similarity search — making it ideal for RAG applications, semantic search, recommendation systems, chatbots, and more.

Why Subscribe to Our Offering in AWS Marketplace

Accessing Your AMI from AWS Marketplace

To get started with your PostgreSQL + pgvector stack:

  1. Subscribe: Purchase the PostgreSQL with pgvector AMI from the AWS Marketplace.
  2. Connect via SSH:
    • In the AWS Console, select your launched instance and click Connect.
    • Choose SSH Client and follow the connection instructions shown.
    • From your local terminal, connect using your .pem key file:
    ssh -i yourpemfile.pem ubuntu@<public-ip-of-your-server>
For more information, refer to the AWS Instance Connection Guide.

Sample Vector Database Setup

We have created a sample database named sample_vector_db and enabled the pgvector extension in it. You can create the same setup yourself by running the following commands:

CREATE DATABASE sample_vector_db;

\c sample_vector_db

CREATE EXTENSION IF NOT EXISTS vector;

SELECT * FROM pg_extension WHERE extname = 'vector';

Connecting with psql

Launch psql and connect to the sample database:

psql -h localhost -p 5432 -U postgres -d sample_vector_db
Note: The default PostgreSQL superuser is postgres. Make sure to set or update the password after your first login for security.

Working with Vectors in PostgreSQL

1. Create the Items Table

CREATE TABLE items (
    id SERIAL PRIMARY KEY,
    name TEXT,
    description TEXT,
    metadata JSONB,
    embedding VECTOR(1536)
);

2. Insert Sample Data

INSERT INTO items (name, description, metadata, embedding)
VALUES 
('Sample Item 1', 
 'This is a sample item about artificial intelligence.',
 '{"category": "ai", "tags": ["ml", "vector"]}',
 '[0.12, 0.45, 0.67, ...]'::vector);

3. Perform Similarity Search (Cosine Distance)

SELECT 
    id, name, description,
    embedding <=> '[0.12, 0.45, 0.67, ...]'::vector AS distance
FROM items
ORDER BY embedding <=> '[0.12, 0.45, 0.67, ...]'::vector
LIMIT 5;

Adding an Index for Better Performance

For production workloads with large datasets, add an HNSW index to speed up vector similarity searches:

CREATE INDEX idx_items_embedding 
ON items 
USING hnsw (embedding vector_cosine_ops)
WITH (m = 16, ef_construction = 64);
Tip: HNSW (Hierarchical Navigable Small World) indexes provide fast approximate nearest-neighbor search. Tune m and ef_construction based on your dataset size and performance requirements.

AWS Cost Optimizer — CloudInsider

Our other popular offering is the AWS Cost Optimizer aka CloudInsider, available in AWS Marketplace. This service has helped our customers save significantly on AWS and other cloud spending. It is easy to subscribe and you can see the savings in minutes.

▶ Watch Demo Video Subscribe on AWS Marketplace

Support

For any questions or assistance with our AWS Marketplace offering, reach out to us at support@theglobalsolutions.net.