Quickstart

Quickstart

The quickstart sets up a ReadySet instance and a sample database on your local machine using Docker.

💡
Before starting, make sure you have Docker Engine version >= 19.03.0​ and Docker Compose V2 OR Docker Desktop >= 4.1.0 and the MySQL or Postgres client installed.

1. Download and run the ReadySet Docker compose file

curl -L -o compose.yml                                  \
  "https://readyset.io/quickstart/compose.postgres.yml" \
  && docker compose pull                                \
  && docker compose up -d

2. Import sample data

curl -L -s "https://readyset.io/quickstart/imdb-postgres.sql" \
  | psql 'postgresql://postgres:readyset@127.0.0.1:5433/testdb'
⚠️

Data loading will be slow on Macs with Apple Silicon.

3. Connect and explore the dataset

Connect to ReadySet.

psql 'postgresql://postgres:readyset@127.0.0.1:5433/testdb'

Enable query timing.

\timing

Run a sample query.

Note that since we have not created a cache, this query is served by Postgres.

Query:

SELECT count(*) FROM title_ratings
JOIN title_basics ON title_ratings.tconst = title_basics.tconst
WHERE title_basics.startyear = 2000 AND title_ratings.averagerating > 5;

Results:

 count
-------
  2418
(1 row)
 
Time: 154.980 ms

4. Cache a query!

Using the CREATE CACHE FROM SQL extension, cache the query in ReadySet.

CREATE CACHE FROM SELECT count(*) FROM title_ratings
JOIN title_basics ON title_ratings.tconst = title_basics.tconst
WHERE title_basics.startyear = 2000 AND title_ratings.averagerating > 5;

Validate that creating the cache succeeded by running the query again. This time, it is served by ReadySet.

Query:

SELECT count(*) FROM title_ratings
JOIN title_basics ON title_ratings.tconst = title_basics.tconst
WHERE title_basics.startyear = 2000 AND title_ratings.averagerating > 5;

Results:

 count(*)
----------
     2418
(1 row)
 
Time: 2.073 ms

5. Explore Grafana

Navigate to localhost:4000 to view query latency metrics for ReadySet and Postgres.

6. Try more queries!

Explore the dataset and test ReadySet's performance with additional queries.

View currently cached queries:

SHOW CACHES;

View proxied queries:

SHOW PROXIED QUERIES;

Remove a cache:

DROP CACHE <cache id>;