Retool DB Vector Extension

I was trying to get Mem0 hooked up in a Python Code block and I noticed the Retool DB has the vector extension added

SELECT *
FROM pg_extension;

are we able to create vector tables/columns directly?

CREATE TABLE items (id bigserial PRIMARY KEY, embedding vector(3));

or

ALTER TABLE items ADD COLUMN embedding vector(3);

I didn't want to mess up the DB accidently by trying it out

1 Like

:eyes:

Hey @bobthebear,

Did you go ahead and try this? I'm curious as exploring the options of this and would be great to test first with retool's database.

Edit: I went ahead and created a column with

ALTER TABLE products ADD COLUMN embedding vector(1536);

and then checked the column settings with

SELECT attname, atttypmod
FROM pg_attribute
WHERE attrelid = 'products'::regclass
  AND attname = 'embedding';

and got

image

So this seems to be working (at least when creating it, will try to insert data to it next)

1 Like

:joy: I was 100% not brave enough to find out so thank you so much!! :beers:

2 Likes

Hey @bobthebear, @MiguelOrtiz,
You might know this already but the Retool DB uses Neon under the hood. You can read more about the pgvector extension here.

A Neon db is easy to setup and I find I prefer it to the Retool DB is some production environments. They have plenty of cool features like Point-in-time Restore (24 hours on the free version) and Branches (makes setting up staging/production environments fast and easy).

If you're worried about messing up a DB, do it at Neon :sweat_smile:

3 Likes

Thanks Shawn! I usually use Supabase which also has pgvector. However I have a client that currently doesn't want to move away from Retool's db and I need to make it work with what it has.

2 Likes

I've been meaning to try Supabase. It does look like a solid choice as well. I found this comparison, pretty exhaustive. Plenty of overlap but I can see where Supabase would come out a winner for some clients.

2 Likes