Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Sorry this is not really an answer to your question, but rather my own musings on the problem.</p> <p>I'd suggest storing your lists in a separate table. That'll enable you to do a joined select from the two tables in the end. You may or may not use indexes on the filter table, depending on the performance tests with your data.</p> <p>The exact implementation would differ given the particular RDMBS you intend to use. In my example I'll stick to Oracle, as it's what I know best.</p> <pre><code>CREATE TABLE t_filter_lists ( f_letter varchar2(1), f_number number ); -- Optionally, create an index: CREATE INDEX ix_filter_lists ON t_filter_lists ( f_letter, f_number ); INSERT INTO t_filter_lists (f_letter, f_number) VALUES ('A', 1); INSERT INTO t_filter_lists (f_letter, f_number) VALUES ('A', 2); INSERT INTO t_filter_lists (f_letter, f_number) VALUES ('B', 1); INSERT INTO t_filter_lists (f_letter, f_number) VALUES ('C', 2); COMMIT; -- (Oracle-specific part) gather statistics on the filter table EXEC DMBS_STATS.GATHER_TABLE_STATS(... -- Run your query SELECT * FROM t_your_table t INNER JOIN t_filter_lists f ON f.f_letter = t.t_letter AND f.f_number = t.t_number; </code></pre> <p>The benefit of this solution is that, given that the table and index statistics are complete and fresh, you will not have the headache to choose the correct order of the predicates depending on which and how columns are indexed, in which order, what is their estimated cardinality etc. The optimizer will do that work for you, and it should be quite good at it.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload