The database contains only 2 tables:
- wallet (1 million rows)
- transaction (15 million rows)
CockroachDB 19.2.6 runs on 3 Ubuntu machines
- 2vCPU each
- 8GB RAM each
- Docker swarm container
vs
SQL Server 2019 runs on 1 machine Windows Server 2019
- 4vCPU
- 16GB RAM
Here is the request
select * from transaction t
join wallet s on t.sender_id=s.id
join wallet r on t.receiver_id=r.id
limit 10;
- The SQL Server take only 35ms to return the first 10 results
- CockroachDB take 3.5-5 min for it.
1) I know that the infrastructure is not fair enough for CockroachDB but though.. the different is really too big. Am I missing something? or CockroachDB is just very slow for this particular SQL request?
2) When I execute this request, the CPU of all 3 cockroach nodes went up to 100%. Is it normal?
Update: here is the request "EXPLAIN". I'm not sure how to read it..
> explain select * from transaction t
-> join wallet s on t.sender_id=s.id
-> join wallet r on t.receiver_id=r.id
-> limit 10;
tree | field | description
+---------------------+--------------------+----------------------+
| distributed | true
| vectorized | false
limit | |
│ | count | 10
└── hash-join | |
│ | type | inner
│ | equality | (receiver_id) = (id)
│ | right cols are key |
├── hash-join | |
│ │ | type | inner
│ │ | equality | (sender_id) = (id)
│ │ | right cols are key |
│ ├── scan | |
│ │ | table | transaction@primary
│ │ | spans | ALL
│ └── scan | |
│ | table | wallet@primary
│ | spans | ALL
└── scan | |
| table | wallet@primary
| spans | ALL