# Filtering queries using Metadata vs Namespace

**URL:** <https://community.pinecone.io/t/filtering-queries-using-metadata-vs-namespace/918>\
**Category:** General\
**Tags:** semantic-search, vector-database\
**Created:** [March 26, 2023, 3:09pm UTC](https://community.pinecone.io/t/filtering-queries-using-metadata-vs-namespace/918 "2023-03-26T15:09:36Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lnetanel](https://avatars.discourse-cdn.com/v4/letter/l/45deac/32.png) [@lnetanel](https://community.pinecone.io/u/lnetanel)\
**Post date:** [March 26, 2023, 3:09pm UTC](https://community.pinecone.io/t/filtering-queries-using-metadata-vs-namespace/918/1 "2023-03-26T15:09:36Z")

</div>

Hi all,  
We are reviewing Pinecone as a solution for a vector database to store Embeddings of user messages.  
My main question is how to store the vectors so we can query only specific user messages.  
From what I read, there are two options.  
Using meta data or using namespaces.  
Can anyone share pros/cons for each of those options?

---

<div class="post-metadata">

**Author:** ![rajat](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/rajat/32/3037_2.png) [@rajat](https://community.pinecone.io/u/rajat)\
**Post date:** [March 26, 2023, 4:15pm UTC](https://community.pinecone.io/t/filtering-queries-using-metadata-vs-namespace/918/2 "2023-03-26T16:15:14Z")

</div>

If you use namespaces, you won’t be able to query across different namespaces. So I would say go for them only if you want a stringent division between users here. Otherwise, metadata is a good option. Be careful, as _very_ high cardinality on metadata will come with performance costs and consume more resources in an index.

---

<div class="post-metadata">

**Author:** ![lnetanel](https://avatars.discourse-cdn.com/v4/letter/l/45deac/32.png) [@lnetanel](https://community.pinecone.io/u/lnetanel)\
**Post date:** [March 27, 2023, 6:47am UTC](https://community.pinecone.io/t/filtering-queries-using-metadata-vs-namespace/918/3 "2023-03-27T06:47:26Z")

</div>

Thanks Rajat!  
I do want a complete separation between the users so seams that namespace should be the way to go.  
Is there any limit on the number of namespaces I can create on a given index?

---

<div class="post-metadata">

**Author:** ![amanda1](https://avatars.discourse-cdn.com/v4/letter/a/ec9cab/32.png) [@amanda1](https://community.pinecone.io/u/amanda1)\
**Post date:** [March 27, 2023, 4:18pm UTC](https://community.pinecone.io/t/filtering-queries-using-metadata-vs-namespace/918/4 "2023-03-27T16:18:04Z")

</div>

Would like to know the answer to “Is there any limit on the number of namespaces I can create on a given index?” as well. (i.e. is the index being optimized for horizontal or vertical scaling)?

---

<div class="post-metadata">

**Author:** ![rajat](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/rajat/32/3037_2.png) [@rajat](https://community.pinecone.io/u/rajat)\
**Post date:** [March 27, 2023, 4:50pm UTC](https://community.pinecone.io/t/filtering-queries-using-metadata-vs-namespace/918/5 "2023-03-27T16:50:37Z")

</div>

There is no limit on the number of namespaces that you can create. A very large number of namespaces will also come with performance hits, but unlike metadata cardinality, it doesn’t creep up on you as you are always aware of the namespaces that you have 🙂
