I have a simple query that runs quite fast (1-2 seconds) and returns 20 rows:
select * from table where field1 = 'ABC'
However, if I add one more filter on another field, like:
select * from table where field1 = 'ABC' and field2 = 'XYZ'
the query times out (we have a limit of 30 secs). If it matters, the query is expected to return the same 20 rows in our case.
Both fields are not part of the sort key, and the table contains about 250 million rows with about 20 columns.
The question is: is it expected behaviour? I would expect the queries run times should be more or less equal. If it is expected, is there a guide what kind of queries one should avoid, or is there a tool that allows to investigate whether it's a "bad" query.
Thanks in advance!
clickhouse-clientor JDBC? - Ramazan Polat