Quick start
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.
1. Start the CoraDB service
Section titled “1. Start the CoraDB service”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: successOn 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.
2. Open a demo database
Section titled “2. Open a demo database”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-commerceThis may take a long time depending on the amount of recovery works to do.CoraDB 1.0++ coradb server start: successTo start a database automatically with coradb service start, list it in the server parameter of coradb.conf:
[service]service=server,broker,managerserver=e-commerce3. Create your own database
Section titled “3. Create your own database”coradb createdb creates the database volumes in the current directory. Give the database a name and a locale, then start it:
mkdir testdb && cd testdbcoradb createdb testdb en_UScoradb server start testdbls -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.
4. Run your first queries
Section titled “4. Run your first queries”Open the corasql interpreter:
corasql -u dba e-commerceA relational query on the orders table:
SELECT EXTRACT(YEAR FROM order_date) AS yr, COUNT(*) AS ordersFROM ordersGROUP BY yrORDER 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 followersFROM MATCH (cu:customer)-[:follows]->(b:brand)GROUP BY b.nameORDER BY followers DESC, b.nameLIMIT 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 ordersFROM MATCH (cu:customer)-[:resides_in]->(ci:city), orders oWHERE o.customer_id = cu.id AND ci.name = 'London'GROUP BY cu.company_nameORDER BY orders DESC, cu.company_nameLIMIT 3;| cu.company_name | orders |
|---|---|
| Hicks-Marshall | 15 |
| Jordan, Smith and Bartlett | 15 |
| Hernandez, Wilson and Johnson | 10 |
Type ;exit to leave corasql.
Next steps
Section titled “Next steps”- Learn the SELECT statement and graph queries with MATCH.
- Build your own tables and graph in the tutorial, and see Relational and graph in one query.
- Connect from an application with a driver: PHP, ADO.NET, Python, Node.js, JDBC or C (CCI).
- Explore the other query tools.