With a large volume of queries per second logging all queries gets expensive, it would be nice to be able to log only a configurable fraction of the queries, selected at random.
const String & query,
    ContextMutablePtr context,
    bool internal,
    QueryProcessingStage::Enum stage,
    bool may_have_embedded_data,
    bool allow_processors)
{
    BlockIO res = executeQuery(query, context, internal, stage, may_have_embedded_data);
    if (!allow_processors && res.pipeline.initialized())
        res.in = res.getInputStream();
    return res;
}
void executeQuery(
    ReadBuffer & istr,
    WriteBuffer & ostr,
    bool allow_into_outfile,
    ContextMutablePtr context,
    std::function<void(const String &, const String &, const String &, const String &)> set_result_details,
    const std::optional<FormatSettings> & output_format_settings,
    std::function<void()> before_finalize_callback)
{
    PODArray<char> parse_buf;
    const char * begin;
    const char * end;