Skip to content

Quick start

View as Markdown

This guide takes you from a fresh installation to your first graph query. It assumes CoraDB is already installed and its environment variables are set.

The service starts the master process, the broker (which accepts client connections, port 33000 by default) and the CoraDB Manager Server (CMS):

coradb service start
@ coradb master start
++ coradb master start: success
@ coradb broker start
++ coradb broker start: success
@ coradb manager server start
++ coradb manager server start: success

On Windows you can also start and stop CORADBService from Services (Control Panel › Administrative Tools), or with Service Start / Service Stop in the CoraDB Service Tray menu. Controlling the service needs administrator rights there; from a shell, a normal login user is enough.

See Controlling CoraDB processes for all service commands.

CoraDB includes ten ready-to-use demo databases. This guide uses e-commerce, the sample database of the whole manual. Start its server:

coradb server start e-commerce
@ coradb server start: e-commerce
This may take a long time depending on the amount of recovery works to do.
CoraDB 1.0
++ coradb server start: success

To start a database automatically with coradb service start, list it in the server parameter of coradb.conf:

[service]
service=server,broker,manager
server=e-commerce

coradb createdb creates the database volumes in the current directory. Give the database a name and a locale, then start it:

mkdir testdb && cd testdb
coradb createdb testdb en_US
coradb server start testdb
ls -l
-rw------- 1 coradb dbms 536870912 Nov 17 15:04 testdb
-rw------- 1 coradb dbms 536870912 Nov 17 15:04 testdb_lgar_t
-rw------- 1 coradb dbms 536870912 Nov 17 15:04 testdb_lgat
-rw------- 1 coradb dbms 176 Nov 17 15:04 testdb_lginf
-rw------- 1 coradb dbms 183 Nov 17 15:04 testdb_vinf
File Content
testdb First data volume
testdb_lgat Active log
testdb_lgar_t Background archive log
testdb_lginf Log information
testdb_vinf Volume information

Without options, 1.5 GB is allocated (512 MB each for the data volume, the active log and the background archive log). Use --db-volume-size and --log-volume-size to change it, and coradb addvoldb to add volumes later. See createdb and Database volume structure.

Open the corasql interpreter:

corasql -u dba e-commerce

A relational query on the orders table:

SELECT EXTRACT(YEAR FROM order_date) AS yr, COUNT(*) AS orders
FROM orders
GROUP BY yr
ORDER BY yr;
yr orders
2021 416
2022 482
2023 551
2024 675
2025 786

A graph query: which brands have the most followers?

SELECT b.name, COUNT(cu) AS followers
FROM MATCH (cu:customer)-[:follows]->(b:brand)
GROUP BY b.name
ORDER BY followers DESC, b.name
LIMIT 3;
b.name followers
Nike 209
Adidas 132
Puma 94

A hybrid query: a graph pattern (customers and their city) joined with a relational table (orders):

SELECT cu.company_name, COUNT(o.id) AS orders
FROM MATCH (cu:customer)-[:resides_in]->(ci:city),
orders o
WHERE o.customer_id = cu.id
AND ci.name = 'London'
GROUP BY cu.company_name
ORDER BY orders DESC, cu.company_name
LIMIT 3;
cu.company_name orders
Hicks-Marshall 15
Jordan, Smith and Bartlett 15
Hernandez, Wilson and Johnson 10

Type ;exit to leave corasql.