Skip to content
New issue

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

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

Already on GitHub? # to your account

Allow overriding filter_records, sort_records #272

Closed
ohaddahan opened this issue Jan 16, 2018 · 2 comments
Closed

Allow overriding filter_records, sort_records #272

ohaddahan opened this issue Jan 16, 2018 · 2 comments
Assignees

Comments

@ohaddahan
Copy link

ohaddahan commented Jan 16, 2018

I stumbled upon some performance issues that aren't originating from the Gem but affect the performance.

  1. The default behaviour includes two calls to count , before and after filtering.
    This can be expensive on large tables , I recommend as a minimum to explain in the documentation that get_raw_records should include some where query to minmize full table sweeps.

  2. It seems PostgreSQL and rails order don't act as expected (at least by me). Might be related to the query planning in the Gem. It seems to run ORDER BY on the entire table and SELECT after. While the other way around seems a lot more efficient , assuming the SELECT will minimize the number of results dramatically.

  3. Continuing (2) , I tried overriding filter_records and sort_records right under where it says

# ==== These methods represent the basic operations to perform on records

to try and play with the query planning but they don't seem to be called from the

@ohaddahan
Copy link
Author

ohaddahan commented Jan 16, 2018

  1. I think I read explain wrong , need to solve some DB issues on my application.
    Looking for some way to timeout specific slow queries.

  2. Need to override

module AjaxDatatablesRails
  module ORM
    module ActiveRecord
      def filter_records(records)
      end
      def sort_records(records)
      end   
    end
  end
end

Just placing them inside the datatable class doesn't seem to help.

@n-rodriguez n-rodriguez self-assigned this May 5, 2018
@n-rodriguez n-rodriguez changed the title Performance tweaking [enhancement] Performance tweaking May 5, 2018
@n-rodriguez
Copy link
Member

I think I read explain wrong , need to solve some DB issues on my application.

Ok.

Just placing them inside the datatable class doesn't seem to help.

I know : #228. I'm looking for a solution ;)

@n-rodriguez n-rodriguez changed the title Performance tweaking Allow overriding filter_records, sort_records May 10, 2018
# for free to join this conversation on GitHub. Already have an account? # to comment
Projects
None yet
Development

No branches or pull requests

2 participants