Glad to be of help! And the only thing you lose, to my knowledge, is disk space and memory space. For reference, the system my company has created generates pretty complex queries on the fly, and multiple times we’ve ended up using something like 10GB of plancache in memory and about the same on disk, which has brought our system to a complete halt several times (we didn’t set up much disk space).
This brings me to “what counts as a query”. When we were reaching these crazy plancache sizes, we were generating queries that weren’t “structurally identical”. By “structurally identical”, I mean that SingleStore appears to do what e.g. JDBC does with query parameterization and just compare the parameterized versions of the queries. For instance select * from whatever_table where x = 1
is in this sense “structurally identical” to select * from whatever_table where x = 2
— here 1
and 2
are treated as parameters to a query. We ended up sorting some clauses in our query to make sure we had as much structural identity as possible (e.g. we would generate the clauses x = ? and z = ? and y = ?
, z = ? and y = ? and x = ?
, etc., and we sorted this part to always have it be x = ? and y = ? and z = ?
). You probably aren’t generating queries on the fly so that part probably doesn’t apply to you, but just was throwing it out there.
Anyway, to directly answer question 2, these seem like all one (structurally identical) query for plancache/precompilation purposes.