Efficient use of cache with different numbers of columns on Select queries

I have some table:

CREATE TABLE tests (
	a timeuuid,
	b double,
	c text,
	d timestamp,
    other columns...
	PRIMARY KEY (a)
);

and I need different columns for different cases. For example:
Q1: select a, b from tests where a = ? limit 1;
Q2: select a, c from tests where a = ? limit 1;
Q3: select c, b from tests where a = ? limit 1;
Q4: select b from tests where a = ? limit 1;

Im not using BYPASS CACHE. Different cases have different throughput. What will be more effective: make different statements for specific required fields or make one general statement, for example: select a, b, c from tests where a = ? limit1;

Will it be more efficient to take data from the cache in one request? I want to understand whether different requests will be stored in separate caches or will they be grouped? Need I worry about it ?)

There is a single unified cache per table, on each replica. Whether you have 1 prepared statements or 10 prepared statements reading the same partition, it makes no difference from the cache POV.

BTW, you don’t need the limit 1, your partition will have exactly one row anyway, since you have no clustering columns.

2 Likes