On Wed, 17 Oct 2012 14:38:53 +0700, Ivan Shmakov <
onei...@gmail.com>
wrote:
> I wonder if there's a database implementation (or data
> structure, or an index) well suited for queries like the
> following:
Well-suited in what way? Are you looking for ease-of-use? Speed
of access? What?
> SELECT * FROM foo
> WHERE (a1 IN (a1a, ..., a1P)
> AND a2 IN (a2a, ..., a2Q)
> ...
> AND aN IN (aNa, ..., aNZ));
>
> where a1, ..., aN are all but one of the table columns, and
> P, Q, ..., Z may vary (and are not necessarily equal to each
> other.)
Are you trying to validate the data in the table?
You have not given much detail. What about putting a1a..a1P in a
lookup table and so on for a2*..aN*?
> To note is that the amount of INSERT's into the structure is
> non-negligible when compared to the number of SELECT's.
^^^^^^^^^^^^^^
Nearly meaningless. How many inserts? How many selects?
> Also, I'd be interested in a quick way to compute an estimate
> (an upper bound) of the number of rows to be returned from the
> query above.
Other than the obvious number of rows in the table, I think any
answer would be a guess.
Sincerely,
Gene Wirchenko