For now I do: Person.where(name: 'Dennis').count.positive? # took 0.1ms. any? did took 0.8ms due to full row select.
But would like to know if there is a native method for this. On Sunday, February 21, 2021 at 7:28:54 PM UTC+3 [email protected] wrote: > Hi Jeremy, > > I was using to check if any record exists on table: > > Person.where(name: 'Dennis').any? > > But as far as i see in my logs, this fetch the whole record and translated > as: > > SELECT * FROM persons WHERE name = 'Dennis' > > How can I check existence (if any record available) without fetching whole > record(s)? > > Thanks, > Dennis. > -- 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/e1c84b96-e933-4a36-8d9c-ed207ec34393n%40googlegroups.com.
