LaravelDaily / laravel-charts

Package to draw charts in Laravel with Chart.js
MIT License
531 stars 118 forks source link

Optimization #74

Open SeadSilajdzic opened 3 years ago

SeadSilajdzic commented 3 years ago

Hello, is there a way to optimize queries from this package?

Right now the query is "select * from table" and I guess that is not good because if someone is using this for bigger projects where there might be 10k users the application will use 50MB of ram and there will also be 10k models loaded and wait time will be about 3-5s.

We just need numbers of rows related to "created_at" or something like that we don't need all columns.

PovilasKorop commented 3 years ago

@SeadSilajdzic valid point, it's probably worth improving, but we don't actually know what fields we need, in some cases it's created_at, in other cases it's other fields, as there are a lot of grouping parameters.

So it's not an easy task to select the fields. But if you want to contribute, we would happily accept a Pull Request.

SeadSilajdzic commented 2 years ago

Good point, but I guess 90% of people will work with dates. Will try to make it work for me and if I succeed I will contribute :)

keatliang2005 commented 1 year ago

What about have the ability to configure (based on time remembered) and cache generated result on dataset prepareData() method

PovilasKorop commented 1 year ago

@keatliang2005 same answer as above: if you want to contribute with your suggestion as a Pull Request, I'm happy to review.