6
LMagnus
7y

This is why code reviews are important.

Instead of loading a relevant dataset from the database once, the developer was querying the database for every field, every time the method interacted with it.

What should have been one call for 200k records ended up as 50+ calls for 200k records for every one of 300+ users.

The whole production application server was locked.

Comments
  • 3
    This is why QA testing is important. I had to create some indexes this past week, because the app that someone promoted to prod was doing 'select *' queries and running full table scans on millions of rows. We told the app team that they need to rewrite their queries to only call back those columns that they need. The indexes did help, though.
  • 4
    Yea, once our server load was at steady 100%, upon further investigation we found that MySQL was taking all the CPU time and we dug deeper. What did we find? Table with all TEXT columns. Only primary key was VARCHAR (I guess because it just doesn't allow unindexable column as primary key). No wonder changing field types to appropriate ones and indexing some brought load to around 2-3%. It wasn't even a big table, only around couple thousand rows
Add Comment