Re: a database implementation (data structure) for particular queries?

From: Gene Wirchenko <genew_at_ocis.net>
Date: Wed, 17 Oct 2012 09:40:07 -0700
Message-ID: <7dnt785vqpmb5lg7pomdshlnlffku5mgk0_at_4ax.com>


On Wed, 17 Oct 2012 14:38:53 +0700, Ivan Shmakov <oneingray_at_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 Received on Wed Oct 17 2012 - 18:40:07 CEST

Original text of this message