as it happens vs by the by

as it happens

adv
  • By coincidence, incidentally 

by the by

adj
  • Incidental; unplanned. 

prep
  • Used to introduce a new topic; incidentally, by the way. 

How often have the words as it happens and by the by occurred in a corpus of books? (source: Google Ngram Viewer )