# Understanding Vector Database

**URL:** <https://community.openai.com/t/understanding-vector-database/250663>\
**Category:** API\
**Tags:** api\
**Created:** [June 4, 2023, 8:27pm UTC](https://community.openai.com/t/understanding-vector-database/250663 "2023-06-04T20:27:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![jethro.adeniran](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/jethro.adeniran/32/120713_2.png) [@jethro.adeniran](https://community.openai.com/u/jethro.adeniran)\
**Post date:** [June 4, 2023, 8:27pm UTC](https://community.openai.com/t/understanding-vector-database/250663/1 "2023-06-04T20:27:53Z")

</div>

How does tabular numerical data work in vector databases in other words can you just take a csv with numbers like salary data and save it in a vector database AND still be able to perform operations on it as if it were tabular e.g selection and filtering. Or is some context lost? Can it get MAX from a column easily?

---

<div class="post-metadata">

**Author:** ![novaphil](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/novaphil/32/130934_2.png) [@novaphil](https://community.openai.com/u/novaphil)\
**Post date:** [June 5, 2023, 3:23am UTC](https://community.openai.com/t/understanding-vector-database/250663/2 "2023-06-05T03:23:09Z")

</div>

1. Your still limited by the same context window. The only thing embeddings/vector DB’s help with is retrieving chunks of the most relevant information. That information is then added to the standard GPT prompt. It’s really two separate things, embeddings/vector DBs don’t let you pass _more_ information to GPT, they just let you pass _the most relevant_ information.
2. As you might be wondering now, this doesn’t really work well for raw numerical data. But fundamentally, neither do LLMs. They are bad at math. I wouldn’t trust them with MAX anythings. Turns out, regular relational databases are really good at that sort of thing. Probably best route to explore is sharing a relation database schema with GPT and asking it to write SQL queries, but even that can be problematic.

---

<div class="post-metadata">

**Author:** ![jethro.adeniran](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/jethro.adeniran/32/120713_2.png) [@jethro.adeniran](https://community.openai.com/u/jethro.adeniran)\
**Post date:** [June 5, 2023, 6:18am UTC](https://community.openai.com/t/understanding-vector-database/250663/3 "2023-06-05T06:18:21Z")

</div>

That’s interesting. I am currently using step 2 and it works incredibly with pandas. I use few shot examples and a detailed explanation of DB. I was curious if Vector DBs offered much for numerical data at this point. Thanks for pointing it out.

---

<div class="post-metadata">

**Author:** ![abhi3hack](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/abhi3hack/32/34494_2.png) [@abhi3hack](https://community.openai.com/u/abhi3hack)\
**Post date:** [June 5, 2023, 6:30am UTC](https://community.openai.com/t/understanding-vector-database/250663/4 "2023-06-05T06:30:04Z")

</div>

> [@jethro.adeniran](#):
>
> That’s interesting. I am currently using step 2 and it works incredibly with pandas.

Hey @jethro.adeniran  
Can you say how you have described your db ?  
Because when I have done this thing the chatgpt could not understand which table to pick when I passed all the table names it has an issue with column names then I shared the column names based on the table names it was picking because my data is formatted in json in some of the columns I even sent the structure of it in the prompt  
Even after this it could not write a proper query  
Next I have tried sending it some sample queries also but this obviously was increasingly my prompt length

Now I am trying to use embeddings to do these things  
wish to hear your opinion on that

I have posted a question about this in the community please have a look

> [@Creating a Chatbot using the data stored in my huge database](https://community.openai.com/t/creating-a-chatbot-using-the-data-stored-in-my-huge-database/245942):
>
> Hello Everyone, I want to build a custom chat bot which can answer questions based on the data in my databse Below are my tries and the problems I am facing I am open for all suggestions, so please do help me Tried without using langchain The code establishes a connection to a PostgreSQL database and prompts the user for information they want to obtain. It then generates an SQL query based on the (user input + the table names of the db) using the OpenAI GPT-3.5 language model. The code e…

---

<div class="post-metadata">

**Author:** ![jethro.adeniran](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/jethro.adeniran/32/120713_2.png) [@jethro.adeniran](https://community.openai.com/u/jethro.adeniran)\
**Post date:** [June 5, 2023, 2:38pm UTC](https://community.openai.com/t/understanding-vector-database/250663/6 "2023-06-05T14:38:13Z")

</div>

Do you have many databases oR one ?  
If you have one, create as part of your prompt a description of the database include a percentage of column names and explain what they mean etc – and then give it actually few shot examples of queries you need.

Your first prompt must have a lot of info – maybe not too big-- then you will get a reliable sql or python that matches specific database.  
But also try to store prompts as a string - before sending and printing them to check where it is going wrong.

Temperature is also important, lower is better when it comes to generating code – say 0.3  
All in all what mine does is simple it knows the database well and it has good examples of code i expect i interecept with a Python REPL and run the pandas and send the result as html which i output on frontend.
