fetching record from cockroach db is very slow

I have deployed cockroach db on EKS cluster with 3 nodes. For 1000 transaction on avg save update take 25ms while select stmnt is taking around 7.5 Seconds. Table already have composite primary key and we are fetching data with help of composite primary key columns.
Why cockroach database taking long time to fetch the record in compare to save and update and how we can optimize it

What is your DDL, please run explain <query here> on the sql shell and paste the output.

Thank you Matthew,

Please find the information below.

root@cockroachdb-public:26257/ngp> explain select operationh0_.operation_id as operatio1_0_0_, operationh0_.terminal_id as terminal2_0_0_, operationh0_.operations as operatio3_0_0_ from operation_history operationh0_ where operationh0_.operation_id=0 and operationh0_.terminal_id=‘test244’
-> ;
tree | field | description
±-----±------±----------------------------+
scan | |
| table | operation_history@primary
| spans | /0/“test244”-/0/“test244”/#
(3 rows)

Time: 2.148279ms

root@cockroachdb-public:26257/ngp> explain analyze select operationh0_.operation_id as operatio1_0_0_, operationh0_.terminal_id as terminal2_0_0_, operationh0_.operations as operatio3_0_0_ from operation_history operationh0_ where operationh0_.operation_id=0 and operationh0_.terminal_id=‘test244’ ;
automatic | url
±----------±-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
false | https://cockroachdb.github.io/distsqlplan/decode.html#eJyMkLFOAzEQRHu-4jS0RneHUrmiTQMo0JETMudVsHTxWrsbQRTdZ_EDfBnKuUApkCjnjT07uydkjnQf9qTwL-gxOBThkVRZzqg-WMdP-M4h5XKwMx4cRhaCP8GSTQSP5_A20YZCJGk7OESykKYltkjaBznecSEJlji_vic1liMcnkrI6pu2a7cwUrtdrba4uZTtNRyEP7QRCtE3PRzUwjQ1lvbkm9X3l2KYHfhgvwXVwo7g-9n9f4kNaeGsdNH_r-RuHhwo7qgeSvkgIz0Kj8uYKh-WfwuIpFbdvop1rtY8zFc_AQAA___oBIH4
(1 row)

Time: 6.41966ms

I am facing slow response of select statement while performance test is running with 1000 thread and to avoid row contention I have inserted 1000 records into this table.

We pass these terminal_id and operation_id to performance test - Test reads the record and then update the binary data (operations column) .of operation_history table.

Hi @anjani,

Let’s continue this thread over on the ticket you created at support.cockroachlabs.com.

I will reply there, thank you.

Best,
Matt