Skip to main content
11 events
when toggle format what by license comment
Aug 14, 2014 at 20:35 history edited Erwin Brandstetter
edited tags
Aug 14, 2014 at 20:04 history edited ypercubeᵀᴹ CC BY-SA 3.0
edited title
Aug 14, 2014 at 19:43 answer added Erwin Brandstetter timeline score: 2
Aug 14, 2014 at 18:33 vote accept kolrie
Aug 14, 2014 at 17:45 comment added Erwin Brandstetter Essential information for optimization: Cardinalities of involved tables. How many different user_id in each table? How many distinct race_id in laps? What percentage of rows is after updated_at > '2014-06-13' in laps? Which are the variable parts of the query? Ideally also: (minimal) table definitions including indexes and constraints.
Aug 14, 2014 at 17:37 comment added Erwin Brandstetter user_id = 1 ... user_id = 148 Two different IDs in the same query? Typo? Or what is the meaning?
Aug 14, 2014 at 9:53 answer added ypercubeᵀᴹ timeline score: 4
Aug 14, 2014 at 7:24 comment added Mihai A derived table seems redundant,use SELECT race_id,MAX(updated_at) FROM laps WHERE user_id = 148 AND updated_at > '2014-06-13' GROUP BY race_id Also a compsoed index on races(account_id,id) might speed things up.Add last_updated_at column to it if it belongs to the races table.
Aug 14, 2014 at 3:02 comment added Craig Ringer Per explain.depesz.com/s/QjK, you're right, most of the time is a seqscan on laps. Is there a composite index on laps(user_id, updated_at)?
Aug 14, 2014 at 2:29 review First posts
Aug 14, 2014 at 4:53
Aug 14, 2014 at 2:27 history asked kolrie CC BY-SA 3.0