CI4 Performance
5 min read
Speed up CI4 with OPcache, select(), page caching, database indexes, and insertBatch().
CI4 Performance Tips
- Enable OPcache — biggest single win
- Use database indexes on all WHERE/JOIN/ORDER columns
- Use
$model->select() — fetch only needed columns - Cache expensive queries with
$cache->save() - Use page caching for static-ish pages
- Use
insertBatch() for bulk inserts — much faster than loop - Use lazy/chunked queries for large datasets
- Enable PHP compression:
zlib.output_compression=On - Use a CDN for static assets
- Profile with
CI_DEBUG=true toolbar