FrozenNode / Laravel-Administrator

An administrative interface package for Laravel
http://administrator.frozennode.com/
MIT License
1.94k stars 503 forks source link

eager loading of relationships #844

Open zoransa opened 9 years ago

zoransa commented 9 years ago

I think this is very important issue. I have tried your sweet app and looks very promising and fro 95% of cases would work just fine except the thing that is extremely memory demanding and very very slow.

I have installed debbuger to see what are you doing and saw this:

SELECT COUNT(id) AS aggregate FROM (select `noses`.* from `noses` group by `noses`.`id`) AS agg

select distinct `noses`.*, name AS `name` from `noses` group by `noses`.`id` order by `noses`.`id` desc limit 20 offset 0

select * from `perfumes`

There is only one little problem... select * fromperfumes` is ~30,000 records table that eats up 175MB of memory.

I know it is hard to make generic application but for relationships you should use eager loading.

davemathews commented 8 years ago

yes we plan to refactor this as soon as possible.