Is there a design reason why you're avoiding something like:

  ids = []
  ids.push(ds1) if x
  ids.push(ds2) if z
  ids.push(ds2) if y

  ds.exclude(id: ids)

Maybe the code around your snippet prevents that. Looking at why may give a
clue at a simple refactor?

Best,
Michael



Le mer. 17 juin 2020 à 13:11, Aryk Grosz <[email protected]> a écrit :

> I was thinking to UNION ALL all the datasets with the pks, and then on the
> last UNION don't use "ALL" so that they get uniqued before being fed into
> the main query.
>
>
> On Wednesday, June 17, 2020 at 1:37:05 PM UTC+3, Aryk Grosz wrote:
>>
>> Many times I find myself writing.
>>
>> ds = ds.exclude(id: ds1) if x
>> ds = ds.exclude(id: ds2) if z
>> ds = ds.exclude(id: ds2) if y
>>
>> Is there any material performance impact of separating out the column
>> loopups?
>>
>> Should I be "UNION"ing the list of ids of first and then just do one
>> exclude/where statement? My guess is it doesn't really matter ultimately
>> because it's a direct lookup on an indexed field even if it's called
>> multiple times.
>>
>> Aryk
>>
> --
> You received this message because you are subscribed to the Google Groups
> "sequel-talk" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sequel-talk/879e53a7-543d-4548-a293-21bb57fc3234o%40googlegroups.com
> <https://groups.google.com/d/msgid/sequel-talk/879e53a7-543d-4548-a293-21bb57fc3234o%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sequel-talk/CAAkfp_RWQafmvo45k0R0%2BKRa10yqZOKcHoujbGsKTedXSuxr-A%40mail.gmail.com.

Reply via email to