On Wed, May 19, 2021 at 2:52 AM Philipp Sebastian Thun < [email protected]> wrote:
> Hello, > > To better understand performance issues related to sub-optimal database > queries, we would like to enhance Sequel's logging. An interesting "metric" > would be the size of the result set for a specific query. > > I found the Sequel::Dataset.post_load function ( > https://github.com/jeremyevans/sequel/blob/68b5e5252107dba17751f730b20b325285209180/lib/sequel/dataset/actions.rb#L1184-L1189) > which seems to be a place where this information could be grabbed. > > But I'm wondering whether it's a good idea to patch this function or if > there is another possibility to get this data that I oversaw. > Dataset#post_load is only called when using Dataset#all. If you are OK only logging queries using Dataset#all, it's a fine thing to use. For anything not using Dataset#all, you probably aren't going to know the size of the result set anyway (at least not something portable between databases/adapters). There are probably database/adapter specific ways to get the information you want, but using those is probably more difficult. Thanks, Jeremy -- 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/CADGZSSeJQT86qxcGN3hFfcYdz0eomcFS9sFV33QZDUt5iYyk6A%40mail.gmail.com.
