This is as easy as running the deactivate command:
CALL relationalai.app.deactivate();However, you might be wondering what this actually does, why you would do it, and if there are any other things you can clear out too. Read more for the answers below.
Why Deactivate?
You might have just finished a project with RelationalAI (RAI), and don't plan on using it again for several months. However you don't want to go to the trouble of fully uninstalling the app, since you'll be using it again later. In this case, deactivate it instead.
If an app is left active, then it will still maintain the barebones internal maintenance processes that keep the application healthy. These can cost between $1-4 per day depending on the account. Deactivating saves costs on those internal services.
What is Deactivation?
Simply put, it shuts down anything that runs and costs credits.
- Nobody will be able to run any queries against RAI. Any queries sent will fail.
- Running engines are suspended. When you reactivate the app, they'll be recreated and resumed automatically.
- Streams stop ingesting or indexing data into your RAI models.
- All background RAI services are stopped. Typically these services check in periodically every 1-10 minutes to see if there is work for them to perform. That would cause a
Ssize service to start up and consume credits. On a deactivated account, these services do not run.
Deactivation Does Not Include
Deactivation is different than uninstallation, because it carries the assumption that you will reactivate at some point. Because of this, some resources remain on the account and not deleted when deactivation occurs. Some examples of things we maintain are listed below
Notebooks/Workspaces
Similarly to uninstalling, we do not delete any notebooks nor workspaces when the app is deactivated. You'll still be able to use and build on your old work when you come back to RAI.
Engines
- Any engines that existed when you deactivated will be automatically recreated on the current app version when you reactivate.
- Any engines that were running when you deactivated will be automatically resumed.
Data
Any data that existed when the app was deactivated will continue to be stored in Snowflake. This includes:
- Indexes for your data streams
- Data for the RAI application
- Internal data like cached query results, stage data, and partial query materializations
Clear Things Out Before Deactivation
To reduce your costs, you might consider taking these additional steps below before deactivating the account.
ATTN: DO NOT delete or suspend the internal RAI Warehouse listed below.
- RELATIONAL_AI_ERP_WAREHOUSE
This is used by RAI internal services. If you delete or suspend it manually, it can cause problems with the deactivation and prevent the app from getting fully deactivated. This warehouse is automatically suspended when the app is deactivated and does not require manual intervention.
Remove Engines
Before deactivating, suspend or delete engines.
If engines are suspended, they won't start up automatically when the app is reactivated. Instead, when you run your first query it will automatically resume the engine indicated in your config. The downside is it will take about 2 minutes for the engine to resume, delaying the first run of your query. The upside is that you won't have a bunch of engines immediately running, which might have been used for automatic workloads before, that you aren't running now.
If engines are deleted, they won't be recreated automatically when the app is reactivated. Instead, when you run your first query it will automatically recreate the engine indicated in your config. The downside is it will take about 5 minutes for the engine to be created, delaying the first run of your query. Deleting engines can also free up data that was associated with them, allowing its deletion as well.
Manually Run the Garbage Collector
A typical RAI app has a percentage of staged/cached data at any given time. This data is kept for a short period to speed up similar query runs in the future. While deactivated, the internal service that performs garbage collection (the blobGC) is suspended. This means it is not periodically clearing out this internal data. While deactivated, the app will continue to store all the data it held at the time it was deactivated, including internal data.
To save costs on data storage, you can force a manual run of the garbage collector. Contact RAI Support at support@relational.ai to find out how much internal data storage exists on your account, and for instructions on manually clearing it. One run of the blobGC can take anywhere from a few minutes to a few hours, depending on how much data you have been using in the account. Support will observe logs and let you know when the blobGC has finished its work and you're ready to deactivate the app.
For more information on internal RAI data stored in stages, as well as the blobGC, please see our article: How to Delete Internal RelationalAI Stage Data
What Happens Next?
When you're ready to use the RelationalAI app again, you can simply run the activate command below to get things up and running again:
CALL relationalai.app.activate();After activating, you do not need to install or update anything. Simply pick right back up where you left off. It will take a few minutes for services and engines to resume. Services and engines will be provisioned on the current version of the native app at that time.