Application talks to YugabyteDB instance with YCQL driver(Gocql). We have below two queries (for example):
SELECT col2,
col3,
col4,
col5
FROM table1
WHERE primarykeycol = 11ab8b12 - a934 - 4f2e - 8a0d - e7eba3faa47f;
INSERT INTO table1
(
primarykeycol,
col2,
col3,
col4,
col5
)
VALUES
(
11ab8b12-a934-4f2e-8a0d-e7eba3faa47f,
222b8b12-a934-4f2e-8a0d-e7eba3faa47f,
'someString',
totimestamp(now()),
totimestamp(now())
)
IF NOT EXISTS returns status AS ROW;
From the last 7 days, data metrics from YugaWare, each SELECT
query (for example shown above) is taking 10ms consistently whereas each INSERT
query takes 30-40ms.
When running explain
statement on SELECT
query says:
QUERY PLAN
Primary Key look up on keySpaceName.table1
Key Conditions: (primarykeyCol = 11ab8b12-a934-4f2e-8a0d-e7eba3faa47f)
Running explain
statement on INSERT
query says:
QUERY PLAN
Insert on keySpaceName.table1
The replication factor of the node cluster is 3.
Based on YugaWare metrics, Why INSERT query is 3-4 times slower than SELECT?