matrixone
matrixone copied to clipboard
[Feature Request]: Vector type
Is there an existing issue for the same feature request?
- [X] I have checked the existing issues.
Is your feature request related to a problem?
A few vector types, let's start with fixed length int/float type vectors. We want to achieve at least feature parity with https://github.com/pgvector/pgvector
However there is no reason to adopt their syntax.
Describe the feature you'd like
create table vt (i int not null primary key, v i8vec(1024));
This will create a table with v as a int8 vector, length 1024. We want i8vec, i16vec, i32vec, i64vec, f32vec, f64vec;
Describe implementation you've considered
No response
Documentation, Adoption, Use Case, Migration Strategy
No response
Additional information
No response
testing leaving a comment.
good, it works. but I don't know if I can create new issues.
This is testing code I used with pgvector. It used an async python binding. We may want to do that as well.
# pg database
# CREATE EXTENSION vector;
# pg table
# CREATE TABLE speedtest (id bigserial PRIMARY KEY, one_k_vector vector(1024));
import numpy as np
import asyncio
import asyncpg
from pgvector.asyncpg import register_vector
table_name = "speedtest"
vec_len = 1024
async def run():
conn = await asyncpg.connect(user='owen', password='',
database='pgvector', host='127.0.0.1')
await register_vector(conn)
# result: python pgv_speed.py 0.47s user 1.90s system 56% cpu 4.187 total
for i in range(1024):
values = []
for i in range(5):
values.append(np.random.rand(vec_len))
await conn.execute(
f'INSERT INTO {table_name} (one_k_vector) VALUES ($1), ($2), ($3), ($4), ($5)',
*values
)
await conn.close()
loop = asyncio.get_event_loop()
loop.run_until_complete(run())