1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 05:14:04 +00:00
laravel-tips/content/tips/using-small-integers-instead-of-entire-class-strings-for-morph-relations-can-improve-their-performance.md
2021-11-05 17:12:37 +01:00

704 B

title tweet_id thread_slug author_username images created_at slug
Using small integers instead of entire class strings for morph relations can improve their performance 1456649615571177476 weekly-thread-2021-44 aarondfrancis
https://pbs.twimg.com/media/FDR-ODWXMA0MA5L.jpg
2021-11-05T15:48:26+00:00 using-small-integers-instead-of-entire-class-strings-for-morph-relations-can-improve-their-performance

When using Laravel morphs, you can eek out some extra performance by using small integers instead of strings for your morph types.

Smaller, faster indexes for the database to manage!

Especially useful for tables like comments or audits, which can be many millions of rows.