# Core version

## Setup

This step consists of setting up the Postgres database where we want to install the toolbox.

A PostgreSQL database is required (RDS, Aurora, Cloud SQL, Azure, etc.)

### Installing extensions

The CARTO Analytics Toolbox makes use of the PostGIS extension. Make sure you have this extension installed in your database. Run the following query to enable the extension.

```sql
CREATE EXTENSION postgis;
```

Some modules require additional extensions. In case you want to make use of them, make sure you have the corresponding extension installed in your database. Run the following query to enable the extensions.

```sql
CREATE EXTENSION plv8; -- Required only by H3
```

### Creating the schema

We’ll create a schema named “`carto`” in the database where you want the CARTO Analytics Toolbox installed. We also recommend creating a dedicated Postgres user called “`carto`” to manage the CARTO Analytics Toolbox.

To do this, connect to your PostgreSQL database and run the following script:

```sql
-- Create the carto schema
CREATE SCHEMA carto;

-- Grant usage to public role
GRANT USAGE ON SCHEMA carto TO public;
GRANT EXECUTE ON ALL FUNCTIONS IN SCHEMA carto TO public;
GRANT EXECUTE ON ALL PROCEDURES IN SCHEMA carto TO public;
```

## Installation

Once the setup is completed, we can proceed with the installation of the toolbox. This step will be performed the first time and every time we want to install an updated version.

### Download the package

This zip file contains the scripts to install the Core version of the Analytics Toolbox. Unzip the content in your local storage. This package will contain:

* LICENSE file
* `modules.sql` file

{% hint style="info" %}
Download the latest installation package from [**here**](https://storage.googleapis.com/carto-analytics-toolbox-core/postgres/carto-analytics-toolbox-core-postgres-latest.zip)
{% endhint %}

### Execute the script

In the destination database, execute the script modules.sql to install the new version of functions and procedures.

{% hint style="danger" %}
WARNING: This script will remove all the previous functions and procedures in the carto schema.
{% endhint %}

### Congratulations!

You have successfully installed the CARTO Analytics Toolbox in your Postgres database.\
Now you can start using the functions in the [**SQL reference**](https://docs.carto.com/analytics-toolbox-postgres/sql-reference/overview/).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.carto.com/data-and-analysis/analytics-toolbox-for-postgresql/getting-access/core-version.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
