MySQL Forums
Forum List  »  Newbie

Re: Recreating a dated series from a change log
Posted by: Rick James
Date: April 28, 2015 01:47PM

With Handler_read_rnd_next = 45 for that query (2 puc_change rows; 30 T_day rows), I suspect the query is O(N*N), hence will not scale well?

The row for 2015-03-01, probably because of
SELECT d.T_day, p.units
    FROM T_days AS d JOIN puc_changes AS p ON p.T_day <= d.T_day  -- "<=" needed.
    WHERE d.T_day BETWEEN '2015-02-24' AND '2015-03-04'
      AND p.T_day = (SELECT MAX(T_day) FROM puc_changes WHERE T_day <= d.T_day);

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.