  In order to study the circumgalactic medium (CGM) of galaxies we develop an
automated pipeline to estimate the optical continuum of quasars and detect
intervening metal absorption line systems with a matched kernel convolution
technique and adaptive S/N criteria. We process $\sim$ one million quasars in
the latest Data Release 16 (DR16) of the Sloan Digital Sky Survey (SDSS) and
compile a large sample of $\sim$ 160,000 MgII absorbers, together with $\sim$
70,000 FeII systems, in the redshift range $0.35<z_{abs}<2.3$. Combining these
with the SDSS DR16 spectroscopy of $\sim1.1$ million luminous red galaxies
(LRGs) and $\sim 200,000$ emission line galaxies (ELGs), we investigate the
nature of cold gas absorption at $0.5<z<1$. These large samples allow us to
characterize the scale dependence of MgII with greater accuracy than in
previous work. We find that there is a strong enhancement of MgII absorption
within $\sim 50$ kpc of ELGs, and the covering fraction within $0.5r_{\rm vir}$
of ELGs is 2-5 times higher than for LRGs. Beyond 50 kpc, there is a sharp
decline in MgII for both kinds of galaxies, indicating a transition to the
regime where the CGM is tightly linked with the dark matter halo. The MgII
covering fraction correlates strongly with stellar mass for LRGs, but weakly
for ELGs, where covering fractions increase with star formation rate. Our
analysis implies that cool circumgalactic gas has a different physical origin
for star forming versus quiescent galaxies.
