phpCopyEdit$json = file_get_contents("bigdata.json"); //High memory usage $data = json_decode($json, true); // Very slow / may crash
Problems:
Loads entire file into RAM.
May hit PHP memory limits (e.g., 128MB or 512MB).
Not suitable for huge datasets unless using chunked streaming, which is complex.
Summary
Format
Best For
Handles 15+ lakh data?
Speed
Memory Use
CSV
Flat/tabular data
Yes
Fast
Low
JSON
Nested/complex data
No (not recommended)
Slower
High
Final Advice
Use CSV if your data is flat (like rows from a database or Excel).
If you’re dealing with hierarchical or nested data and must use JSON, consider splitting the file into smaller parts or using streaming parsers like JSONMachine.