laravel-charts icon indicating copy to clipboard operation
laravel-charts copied to clipboard

Optimization

Open SeadSilajdzic opened this issue 4 years ago • 4 comments
trafficstars

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.

SeadSilajdzic avatar Nov 05 '21 09:11 SeadSilajdzic

@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.

PovilasKorop avatar Nov 05 '21 16:11 PovilasKorop

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 :)

SeadSilajdzic avatar Nov 13 '21 12:11 SeadSilajdzic

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

keatliang2005 avatar Jul 11 '23 07:07 keatliang2005

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

PovilasKorop avatar Jul 11 '23 08:07 PovilasKorop