Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Idea] Limit setting for queries #270

Open
VicenteFava opened this issue Nov 20, 2019 · 7 comments
Open

[Idea] Limit setting for queries #270

VicenteFava opened this issue Nov 20, 2019 · 7 comments

Comments

@VicenteFava
Copy link

Hi,

What do you think about having a limit setting that applies to all the queries if it is set? The idea of this is to prevent the database or the server from having performance issues when executing queries that grab a large amount of data.

If you think that this can be helpful I can do a PR with the code. Thanks!

@ankane
Copy link
Owner

ankane commented Dec 6, 2019

Hey @VicenteFava, thanks for the suggestion! For the database, it's best to set a statement timeout to limit the impact of individual queries. For the server, it'd be good to benchmark where most of the time is spent for large result sets to help decide what to do and test potential solutions. I think a row_limit option would likely help - we'd just need to make it clear to users when the results were limited (including for cached results).

@joelvh
Copy link

joelvh commented May 28, 2020

Hi @ankane, we are using Blazer for some visualizations as well as custom reports. We'd also like to have something like a row_limit for the web view, to limit results which are displayed (or maybe we think of it akin to pagination), while still indicating the total row count.

I've looked at the code and there are several ins and outs that make it hard to know the best place to introduce this limit. We're just looking for a limit on what is displayed in a tabular view. Limiting data for charts isn't a focus for us at the moment. Just tabular view, with the ability to then download the full results.

Could you give some pointers of where best to look at implementing this? I'm happy to put a PR together.

Thanks!

@rdlugosz
Copy link

rdlugosz commented Jun 2, 2021

A nice feature in addition to this would be to impose the row limits on the display version of the results, but allow for downloading the CSV of the full report results.

@aki77
Copy link
Contributor

aki77 commented Jun 2, 2021

#311 PR has already addressed limiting the number of html views only.

@Workman
Copy link

Workman commented Oct 15, 2021

@aki77 +1 to #311. It would be valuable to our team, too. We're forking to include it, but would prefer to stay on the core gem for updates.

@ankane Any thoughts or concerns regarding merging in #311 that would give you pause to merging it in?

@tiagotex
Copy link

tiagotex commented Feb 8, 2022

I've come across the problem in my organization, is there plans to introduce this feature?

@Workman Is your fork public?

@aki77
Copy link
Contributor

aki77 commented Aug 28, 2022

Until the PRs are merged, I am using the following monkey patch.

app/controllers/blazer/queries_controller.rb

require Blazer::Engine.root.join('app/controllers/blazer/queries_controller.rb')

module BlazerQueriesControllerExtention
  def render_run
    if request.format == :html && Blazer.settings['row_limit']
      @row_limit ||= Blazer.settings['row_limit']
    end

    super
  end
end

Blazer::QueriesController.prepend(BlazerQueriesControllerExtention)

config/blazer.yml

row_limit: 5000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants