rtconner / laravel-tagging

Tag support for Laravel Eloquent models - Taggable Trait
MIT License
882 stars 168 forks source link

Performance Issues #99

Closed marianvlad closed 5 years ago

marianvlad commented 8 years ago

I use this package and I have a tag used by ~9k posts and when I use withAllTags method to get the posts, my website dies.

rtconner commented 8 years ago

Any suggestions on what to adjust by chance?

markeilander commented 8 years ago

@marianvlad A simple sollution could be caching.

For one of my older projects i've build a caching layer on top of the tagging trait with some events to cleanup the cache when new tags are inserted.

An other option could be to paginate the results returned by withAllTags

FutureFutureTo commented 5 years ago

Late to the party here but you should definitely paginate your response.

$posts = Post::withAllTags(['tag1, tag2])->paginate();

rtconner commented 5 years ago

Use eager loading please.