PMSF icon indicating copy to clipboard operation
PMSF copied to clipboard

Fix Monocle/Alternative out of memory with KEEP_GYM_HISTORY

Open j16sdiz opened this issue 7 years ago • 6 comments

When KEEP_GYM_HISTORY is on in Monocle/Alternative config, the fort_sighting and raid may contain multiple records of the same gym. Only the latest gym / fort status should be retrieved to avoid out of memory problem.

j16sdiz avatar Jan 30 '18 05:01 j16sdiz

@CalamityJames fixed

j16sdiz avatar Jan 30 '18 16:01 j16sdiz

Actually, the r.time_end >= :time condition save time on both with history and no history case. It's the condition on fs.last_modified that may harm no history performance.

j16sdiz avatar Feb 26 '18 09:02 j16sdiz

@j16sdiz I think you are right about r.time_end >= :time Do you think you can add the config option for the other part? (Default for KEEP_GYM_HISTORY = false)

Glennmen avatar Feb 26 '18 09:02 Glennmen

last_modified and fort_id are indexed. I don't think this would impact the ones who don't use KEEP_GYMHISTORY

Can someone with KEEP_GYMHISTORY = False run a performance test on:

SELECT *	
  FROM forts f
  LEFT JOIN fort_sightings fs ON (fs.fort_id = f.id AND fs.last_modified = (SELECT MAX(last_modified) FROM fort_sightings fs2 WHERE fs2.fort_id=f.id))
  WHERE f.id = 1;

vs

SELECT *	
  FROM forts f
  LEFT JOIN fort_sightings fs ON fs.fort_id = f.id
  WHERE f.id = 1;

I did a test with f.id = 1...20 (uncached) on this and got the following result new avg: 0.071s old avg: 0.066s

123FLO321 avatar Feb 26 '18 10:02 123FLO321

@Glennmen fixed

j16sdiz avatar Feb 27 '18 11:02 j16sdiz

@123FLO321 There is a 6% to 8% perfomance degrade. Personally I don't think this worth the extra code for a few milliseconds gain. But I respect the project owner.

j16sdiz avatar Feb 27 '18 11:02 j16sdiz