Skip to Content

How to speed up semantic searches in Odoo with Supabase when your product database becomes unmanageable

When your catalog grows, searches become slow and frustrating. Discover how vector indexes in Supabase solve this problem and how Ganemo has applied them in real projects.
September 26, 2025 by
How to speed up semantic searches in Odoo with Supabase when your product database becomes unmanageable
Wilfredo Fernando Pastor Avila
| No comments yet

How to speed up semantic searches in Odoo with Supabase when your product database becomes unmanageable

When search stops being fast

Everything works well at the beginning. A catalog with 10,000 products seems manageable, customers find what they need, and agents respond in seconds. But when the catalog multiplies, the search engine stops being agile. Searches take seconds instead of milliseconds, and that means customers waiting, chats going cold and sales slipping away.

This problem is not only technical: it is a business problem. A slow search engine affects user experience and the productivity of customer service and sales teams.

The root of the problem: sequential searches

In PostgreSQL, when using pgvector without indexes, every query scans row by row through all the embeddings. This process is called a sequential scan. With small tables this is not very noticeable, but when going from 20,000 or 50,000 products, response time grows critically.

The solution: vector indexes

A vector index organizes embeddings into groups called clusters, which makes it possible to find similar results much faster. In pgvector, the most widely used is IVFFlat, which divides the table into lists to reduce the number of comparisons.

CREATE INDEX products_embeddings_embedding_ivfflat
ON public.products_embeddings
USING ivfflat (embedding vector_cosine_ops)
WITH (lists = 100);

This command does not create a new column, but an internal structure that speeds up the search. The number of lists is usually calculated as the square root of the number of records. For example, with 50,000 rows, about 225 lists is a good starting point.

Functions that do not change

Your search logic does not need to be modified when creating the index. For example, if you use this function to search for similar products:

CREATE OR REPLACE FUNCTION public.search_vectors(
    query_embedding vector(1536),
    top_n int DEFAULT 3
)
RETURNS TABLE (
    id_odoo integer,
    name text,
    maquina text,
    semantic_text text,
    similarity float
) AS $$
BEGIN
    RETURN QUERY
    SELECT
        p.id_odoo,
        p.name,
        p.maquina,
        p.semantic_text,
        1 - (p.embedding <=> query_embedding) AS similarity
    FROM public.products_embeddings p
    ORDER BY p.embedding <=> query_embedding
    LIMIT top_n;
END;
$$ LANGUAGE plpgsql STABLE;

The function keeps working exactly the same. PostgreSQL will decide whether to use the index or a sequential scan. The change is invisible to the end user: the only thing they will notice is speed.

Real stories with Ganemo

A spare parts distributor that regained trust in its search engine

A distributor with more than 13,000 products used Odoo to serve customers via WhatsApp. When its catalog grew to 50,000, responses took almost two seconds. Ganemo implemented an IVFFlat index with 225 lists. The result: searches in under 100 ms and agents satisfied with the system.

The machinery company that needed precision

A yellow machinery rental company was receiving queries such as “Which filter works for the Caterpillar 320D model?”. Before, the answer depended on the sellers' memory. Ganemo applied embeddings with vector indexes to return the list of compatible spare parts in seconds. The result was a 30% increase in cross-selling.

A support center that reduced handling times

A services company was receiving more than 200 daily tickets with repetitive questions. Ganemo built a semantic search engine over its technical manuals. Agents began receiving suggested answers in real time. The average resolution time was reduced by 45%.

Maintenance and best practices

  • Indexes are updated automatically with new records.
  • You can recreate them if you change the number of lists:
DROP INDEX IF EXISTS products_embeddings_embedding_ivfflat;
CREATE INDEX products_embeddings_embedding_ivfflat
ON public.products_embeddings
USING ivfflat (embedding vector_cosine_ops)
WITH (lists = 200);
  • If you notice slowness after many changes, refresh with REINDEX.

Quick checklist

  1. If your table has fewer than 20,000 records, an index is not urgent.
  2. If you exceed that figure, create an IVFFlat index with √n lists.
  3. Do not change your functions: the index is applied automatically.
  4. Verify with EXPLAIN ANALYZE that the index is in use.

Conclusion

Semantic search stops being a luxury and becomes a necessity when catalogs grow. Vector indexes in Supabase keep the experience agile, even with hundreds of thousands of records. At Ganemo we have verified it: with the right strategy, seconds become milliseconds, and the difference is felt both in customer service and in business metrics.

How to speed up semantic searches in Odoo with Supabase when your product database becomes unmanageable
Wilfredo Fernando Pastor Avila September 26, 2025
Share this post
Archive
Sign in to leave a comment
How to Handle Mercado Pago Refunds in Odoo Without Complications?
Discover the step-by-step process to issue credit notes and refunds integrated with payment terminals in your ERP system