# Retrieving Index from Collection between app sessions

**URL:** <https://community.pinecone.io/t/retrieving-index-from-collection-between-app-sessions/2213>\
**Category:** General\
**Tags:** embeddings\
**Created:** [June 11, 2023, 8:42pm UTC](https://community.pinecone.io/t/retrieving-index-from-collection-between-app-sessions/2213 "2023-06-11T20:42:30Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![dev](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@dev](https://community.pinecone.io/u/dev)\
**Post date:** [June 11, 2023, 8:42pm UTC](https://community.pinecone.io/t/retrieving-index-from-collection-between-app-sessions/2213/1 "2023-06-11T20:42:30Z")

</div>

Scenario:  
I create MyIndex and ingest all the embeddings (along with metadata) that I created with OpenAI API.  
Lets assume that everything is fine and I managed to query what I need.  
Now, I don’t want to let Index service running because it costs money, so I backup the index into collection:

```auto
pinecone.create_collection("MyCollection", "MyIndex");

```

Then I delete the index:

```auto
pinecone.delete_index("MyIndex")

```

Then I exit the app. At this point the index is not running and I am not charged.

Next day, I need to query the embeddings that were ingested into pinecone.  
So, how do I do it?  
The documentations says:

To create an index from a collection, use the create\_index operation and provide a source\_collection parameter containing the name of the collection from which you wish to create an index. The new index is queryable and writable.

pinecone.create\_index(“MyIndex”, dimension=128, source\_collection=“MyCollection”)

However, when I look at the API reference at:  
[https://docs.pinecone.io/reference/create\_index/](https://docs.pinecone.io/reference/create_index/)

I do not see any parameter like source\_collection…  
Can anyone can clarify? Also about whether this is valid approach for saving and restoring the index between app sessions.

---

<div class="post-metadata">

**Author:** ![dra](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/dra/32/171_2.png) [@dra](https://community.pinecone.io/u/dra)\
**Post date:** [June 12, 2023, 6:44am UTC](https://community.pinecone.io/t/retrieving-index-from-collection-between-app-sessions/2213/2 "2023-06-12T06:44:12Z")

</div>

Hello!  
Hmmm, I may not be understanding your problem correctly.  
In cURL, you can generate an Index from a collection with the following code.

 ![create_index](https://us1.discourse-cdn.com/flex020/uploads/pinecone/original/1X/e78ec061fc2f05a99d518ef7648284ebc116e867.png)

 ![reference_create_index](https://us1.discourse-cdn.com/flex020/uploads/pinecone/original/1X/7e0b2f992d003f3ac91158f665776d5b99b34b86.png)

The method of disabling the Index to save money certainly seems effective, though,  
I don’t think it is intended to be used in a way that creates an Index every day. (Such as very large data sets)  
It might be a good way to save money for development purposes.

---

<div class="post-metadata">

**Author:** ![dev](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@dev](https://community.pinecone.io/u/dev)\
**Post date:** [June 12, 2023, 7:02am UTC](https://community.pinecone.io/t/retrieving-index-from-collection-between-app-sessions/2213/3 "2023-06-12T07:02:45Z")

</div>

Basically, you are saying that once you deploy your application it runs all the time while consuming funds, even if you are not using it… otherwise, you have to recreate the index and need to wait between 10 min to few hours when index recreated every time you need it. So, it is not pay for you what you consume model…

---

<div class="post-metadata">

**Author:** ![dra](https://sea2.discourse-cdn.com/flex020/user_avatar/community.pinecone.io/dra/32/171_2.png) [@dra](https://community.pinecone.io/u/dra)\
**Post date:** [June 12, 2023, 8:46am UTC](https://community.pinecone.io/t/retrieving-index-from-collection-between-app-sessions/2213/4 "2023-06-12T08:46:20Z")

</div>

Yes, Pinecone’s pricing model is based on payment by the hour, not by usage. This is an important consideration, especially when planning to use commercial applications.  
(I have been on the Standard plan since March.)

If you are trying things out for personal development purposes, the Free plan may be sufficient.  
Are you using it for commercial purposes?

I personally feel that the risk of the service not working well is higher than the benefit of frequently cold storing Index to reduce the billing amount.  
I think it is not unusual for commercial use to charge several tens of thousands of yen per month.  
(starting at $70/month)

There are several possible ways to reduce the billing amount outside of cold storage.

- Consider consolidating multiple indexes into a singular one, using [namespaces](https://docs.pinecone.io/docs/namespaces) or [metadata](https://docs.pinecone.io/docs/metadata-filtering) to categorize your vectors.
- Optimize your index size by [disabling extra replicas](https://docs.pinecone.io/docs/manage-indexes#replicas) or by initiating [a fresh index with a reduced number of pods](https://docs.pinecone.io/docs/manage-indexes#create-an-index-from-a-collection).
- Think about employing a different model with fewer dimensions, enabling you to [accommodate more vectors within a single pod](https://docs.pinecone.io/docs/choosing-index-type-and-size).
