# Why "local reads" & "local writes" metrics does not exist with YSQL?

**URL:** https://forum.yugabyte.com/t/why-local-reads-local-writes-metrics-does-not-exist-with-ysql/1457
**Category:** General
**Created:** [February 18, 2022, 1:53pm UTC](https://forum.yugabyte.com/t/why-local-reads-local-writes-metrics-does-not-exist-with-ysql/1457 "2022-02-18T13:53:16Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![sham\_yuga](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@sham\_yuga](https://forum.yugabyte.com/u/sham_yuga)
#### Post date: [February 18, 2022, 1:53pm UTC](https://forum.yugabyte.com/t/why-local-reads-local-writes-metrics-does-not-exist-with-ysql/1457/1 "2022-02-18T13:53:16Z")

</div>

With YCQL, we see below metrics for local reads and remote reads.  
But, with YSQL we see BEGIN transactions

 ![Screen Shot 2022-02-18 at 5.50.26 AM](https://canada1.discourse-cdn.com/flex027/uploads/yugabyte/original/1X/4e5646ceb959788f4e6715c4c9a174120370d2c0.png)

 ![Screen Shot 2022-02-18 at 5.50.17 AM](https://canada1.discourse-cdn.com/flex027/uploads/yugabyte/original/1X/f9fc94cf29b791a302e97ff9f07ba71c5f2f49a5.png)

1. Why yugaware metrics does not show “local read” vs “remote read” metrics for YSQL?

2. Does YSQL query plan not include finding the shard owner? before executing the query…

---

<div class="post-metadata">

### Author: ![dorian\_yugabyte](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/dorian_yugabyte/32/206_2.png) [@dorian\_yugabyte](https://forum.yugabyte.com/u/dorian_yugabyte)
#### Post date: [February 20, 2022, 7:46am UTC](https://forum.yugabyte.com/t/why-local-reads-local-writes-metrics-does-not-exist-with-ysql/1457/2 "2022-02-20T07:46:50Z")

</div>

> [@sham\_yuga](#):
>
> Does YSQL query plan not include finding the shard owner? before executing the query…

It does not.

> [@sham\_yuga](#):
>
> Why yugaware metrics does not show “local read” vs “remote read” metrics for YSQL?

Because it’s still not possible to target the correct shard in YSQL so this metric would be random.

---

<div class="post-metadata">

### Author: ![sham\_yuga](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@sham\_yuga](https://forum.yugabyte.com/u/sham_yuga)
#### Post date: [February 20, 2022, 10:37am UTC](https://forum.yugabyte.com/t/why-local-reads-local-writes-metrics-does-not-exist-with-ysql/1457/3 "2022-02-20T10:37:45Z")

</div>

@dorian_yugabyte  
Ok.

Using YCQL, the query plan for INSERT would consist of:  
Finding shard owner,  
Execute query on shard owner,  
Find the replication node for that shard,  
Execute the query on replication node,  
Respond to client

How does YSQL query plan work?

---

<div class="post-metadata">

### Author: ![Alan\_Caldera](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/alan_caldera/32/91_2.png) [@Alan\_Caldera](https://forum.yugabyte.com/u/Alan_Caldera)
#### Post date: [February 20, 2022, 5:47pm UTC](https://forum.yugabyte.com/t/why-local-reads-local-writes-metrics-does-not-exist-with-ysql/1457/4 "2022-02-20T17:47:50Z")

</div>

@sham_yuga

The difference between YCQL and YSQL is where the process that you described previously actually happens currently.  
In YCQL, the driver has first hand information on shard locations / leaders via the `system.partitions` table.  
In YSQL, the driver has no special knowledge of this information at this time, so it connects to a node as directed via either the smart-driver or some other load balancing connection, and once the backend is forked on the node, it discovers this same information via a RPC call. So the backend process where the planner, optimizer and executor has this information to send the appropriate RPC calls to the correct nodes. The RPC calls are executed on the appropriate nodes and the information is returned to the node where the backend process is executing, where it is then returned to a client when the query is completed.

Alan

---

<div class="post-metadata">

### Author: ![sham\_yuga](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@sham\_yuga](https://forum.yugabyte.com/u/sham_yuga)
#### Post date: [February 21, 2022, 1:29am UTC](https://forum.yugabyte.com/t/why-local-reads-local-writes-metrics-does-not-exist-with-ysql/1457/5 "2022-02-21T01:29:59Z")

</div>

@Alan_Caldera  
For your point: _“In YCQL, the driver has first hand information on shard locations / leaders via the `system.partitions` table.”_

I think this token aware feature from gocql driver to remember shard locations, is yet to be supported. Below are the tickets:

```auto
https://github.com/yugabyte/yugabyte-db/projects/51#card-77428223
https://github.com/yugabyte/yugabyte-db/projects/51#card-77427628

```

So, any guess, How much time does it take for these tickets to get resolved?

---

<div class="post-metadata">

### Author: ![dorian\_yugabyte](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/dorian_yugabyte/32/206_2.png) [@dorian\_yugabyte](https://forum.yugabyte.com/u/dorian_yugabyte)
#### Post date: [February 21, 2022, 1:20pm UTC](https://forum.yugabyte.com/t/why-local-reads-local-writes-metrics-does-not-exist-with-ysql/1457/6 "2022-02-21T13:20:34Z")

</div>

> [@sham\_yuga](#):
>
> So, any guess, How much time does it take for these tickets to get resolved?

@sham_yuga I’ve asked the assigned dev to reply on this thread.

---

<div class="post-metadata">

### Author: ![Amogh\_Yugabyte](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.yugabyte.com/amogh_yugabyte/32/508_2.png) [@Amogh\_Yugabyte](https://forum.yugabyte.com/u/Amogh_Yugabyte)
#### Post date: [February 24, 2022, 8:42am UTC](https://forum.yugabyte.com/t/why-local-reads-local-writes-metrics-does-not-exist-with-ysql/1457/7 "2022-02-24T08:42:57Z")

</div>

> So, any guess, How much time does it take for these tickets to get resolved?

@sham_yuga This ticket is on our roadmap and will be taken up soon since we’ve seen increased interest for this feature in recent times. After that it may take around a few weeks to get it released.
