Examining the low-light performance of these two is a twofold affair, and it all stems from the fact that the Xperia behaves quite differently when you're shooting handheld and when you're using a tripod.
When taking photos handheld, the Galaxy is the winner, and there's no shortage of objective reasons for that - wider aperture, OIS, superior noise reduction. The Xperia's photos are noisier and softer, and for the most part trailing in detail despite the extra resolution. 'Trailing', however, may create the wrong impression - it's true that the image quality is not as good as the S9's but it's still miles ahead of any previous Xperia phone.
What's more, when you put the two phones on solid ground (or a tripod), things change. Or rather, nothing changes for the Galaxy, but the Xperia XZ2's Superior Auto mode recognizes the phone is now stabilized and slows down its shutter speed - we're seeing a Tripod icon and a Night scene icon in the viewfinder. Mind you, this is still happening in Superior Auto mode - you don't need to go into Manual.
In our testing it routinely chose 0.8s for shutter speed and we concluded that's the ceiling - as opposed to 1/16s when in hand. The lower shutter speed allows the XZ2 to keep the ISO in the 160-200 range when the Galaxy is forced to use a 1.5-3 stops higher sensitivity. It's not a small difference and the Xperia pulls ahead in detail and clarity.
Now, there's two ways to look at this. On the one hand, the tripod detection is a nice touch and if that helps get cleaner images when the circumstances allow for it - call us in favor. On the other - how often do you carry a tripod around with you? Sure, if you've specifically gone out shooting night scenes you'd have the tools on hand, but at that point your photographic knowledge is probably sound enough for you to be able to work your way around Manual mode too.
Another point worth making is that in this automatically selected Night scene mode you're getting trails from moving lights whether you wanted them or not. Instead, effectively, to stop motion in your night photos, you need to go into Manual and pick a faster shutter speed (and higher ISO).
So, when both phones are kept in their respective automatic camera modes, and the Xperia is stabilized, it will produce sharper, cleaner and more detailed images than the Galaxy S9, albeit with light trails (whether that's a good thing or not depends on the subject). If you forgot your beanbag at home and you're shooting handheld, the Galaxy S9 will outperform the Xperia XZ2 in the dark - again, in full auto modes.
Manual mode is the ultimate equalizer (Pro mode on the Galaxy). We kept the phones on a tripod, locked both to ISO 200 and the Galaxy's brighter aperture lets it use a faster shutter speed 0.3s vs. 0.5s. The two phones exhibit noise in different areas - the Galaxy's well lit portions of the frame are cleaner than the Xperia's but the Xperia's sky is a little smoother. The XZ2's colors are more vibrant though - the Galaxy's output has lost its flair.
One last thing - in all these low light scenes, the Galaxy would fire off shot after shot with no delay in-between. In contrast, the Xperia would take its time after you hit the shutter and take a good 2 seconds before you can shoot again, showing you a progress indicator in the meantime.
Both phones can take portraits with blurred backgrounds despite only having one rear camera each. To shoot portraits with the Xperia, you need to download the Bokeh camera app add-on - it wasn't pre-installed on our unit. It maxes out at 8MP, but there's also a 2MP setting, and you can choose between 4:3 and 16:9 aspects for each resolution. The Galaxy has the 'Selective focus' mode built-in, and maximum resolution is 12MP, like regular stills.
Overall, the Xperia is superior in more than one way. Subject separation is more accurate than on the Galaxy, it's almost Pixel-like. And with the Pixel in the conversation, we should mention that the color reproduction and texture of the Xperia is very similar to Google's. The Galaxy S9, on the other hand, makes faces warmer and more than a little yellowish.
If you're looking for awesome selfies, you won't be super thrilled with the Xperia's shots. They're fine, in much the same way you'd expect from a phone a quarter of the XZ2's price, but not really befitting its flagship position.
The 5MP resolution shouldn't have you expecting heaps of detail, but it's decent. In another episode of 'just Sony things', Superior Auto applies a 'Soft snap' scene mode by default when it detects a face. There's an additional 'Soft skin effect' toggle in settings, which is a different thing and switching it off doesn't interfere with the soft snap scene mode. Still, if you do flip the toggle off, you'll remove all beautification smoothing (or most of it, as far as we can tell).
For sharpest results, you need to stay closer to the Xperia than the default arm's length. We ended up with oversharpened facial hair, excessive contrast and skin colors that were often off towards pink.
The Galaxy's mug shots are sharper, with more fine detail and with vastly more natural processing (quite unlike their main camera).
The Galaxy S9 can do faux-bokeh portraits with its single front facing camera, the Xperia skips that. Samsung's 'Selfie focus' shots actually end up quite good with reasonably accurate separation between subject and background and a pretty natural looking bokeh.