DO SQL shows high rows read in the dashboard but only 1 in the query's returned result

So I ran a simple SQL query in DO like this using exec() (executed at 11:57am):
SELECT id FROM layout WHERE id = 'xyz';
SELECT id FROM layout WHERE id = 'xyz';
The returned result correctly shows rowsRead: 1 and one item in toArray(). However, when I checked the Storage Operations inside DO's metrics in the Cloudflare dashboard, it shows a Rows read 83 at 11:57am instead of 1. I'm very sure I'm the only one accessing the DO at that time, because when I'm not testing the DO, it correctly shows 0 rows read. Subsequent invocations of the same query shows the same 83 count in the dashboard. The "layout" table is indexed and only has 8 rows in it. Running EXPLAIN QUERY PLAN returns this result:
{
"id": 2,
"parent": 0,
"notused": 39,
"detail": "SEARCH layout USING COVERING INDEX sqlite_autoindex_layout_1 (id=?)"
}
{
"id": 2,
"parent": 0,
"notused": 39,
"detail": "SEARCH layout USING COVERING INDEX sqlite_autoindex_layout_1 (id=?)"
}
I cannot figure out why the dashboard is showing such a high number. Is this correct? Also, if I run SELECT id FROM layout, the returned result still only shows rowsRead: 1 (which is strange because it should be 8), while the dashboard shows a count of 172. Can someone shed some light on this discrepancy? Is this a bug in the DO SQL exec() result? Edit: Quick follow up on this. If I execute the initial SELECT consecutively for 8 times in the same minute, the rows read becomes 90 instead of 664 (83 per query * 8 tries). I think the number 90 comes from the first query (83 rows read) plus subsequent 7 tries with 1 row each (83 + 7). Now it makes me wonder, what is the initial high row reads for the query?
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?