Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I wound up here looking for a solution as well. </p> <p>Depending on the high-end number of items you need to query against, and assuming your items are unique, you could split your query into batches queries of 1000 items, and combine the results on your end instead (pseudocode here): </p> <pre><code>//remove dupes items = items.RemoveDuplicates(); //how to break the items into 1000 item batches batches = new batch list; batch = new batch; for (int i = 0; i &lt; items.Count; i++) { if (batch.Count == 1000) { batches.Add(batch); batch.Clear() } batch.Add(items[i]); if (i == items.Count - 1) { //add the final batch (it has &lt; 1000 items). batches.Add(batch); } } // now go query the db for each batch results = new results; foreach(batch in batches) { results.Add(query(batch)); } </code></pre> <p>This may be a good trade-off in the scenario where you don't typically have over 1000 items - as having over 1000 items would be your "high end" edge-case scenario. For example, in the event that you have 1500 items, two queries of (1000, 500) wouldn't be so bad. This also assumes that each query isn't particularly expensive in of its own right.</p> <p>This <em>wouldn't</em> be appropriate if your typical number of expected items got to be much larger - say, in the 100000 range - requiring 100 queries. If so, then you should probably look more seriously into using the global temporary tables solution provided above as the most "correct" solution. Furthermore, if your items are not unique, you would need to resolve duplicate results in your batches as well.</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.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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