Reputation: 397
I am referring the Read-Only transaction, with option min_read_timestamp. As per the document, that executes all reads at a timestamp >= min_read_timestamp.
Assume I have a table with many million rows, but from a specific timestamp, only few rows have been written. How about the performance of this read (assuming only few rows have been written since the timestamp)? Does the spanner internally maintain any index based on the write timestamp to improve the performance of such reads or I still have to rely on my own indexes to speed up the read.
Upvotes: 0
Views: 130
Reputation: 171
As per the documentation, ReadOnlyTransaction with min_read_timestamp will pick a timestamp >= min_read_timestamp and will return all data which was updated at this timestamp or before.
So, using it in a query to get a specific rows updated since min_read_timestamp is not the correct usage.
I would recommend using a query to select all rows where timestamp_column >= specific_timestamp and creating a composite index.
Cloud Spanner doesn't create an index to optimize this query type. You may want to create an index of your own, though I would recommend this read: https://cloud.google.com/spanner/docs/schema-design#creating_indexes
Upvotes: 1