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.
}
        throw;
    }
    setQuerySpecificSettings(ast, context);
    
    String query(begin, query_end);
    BlockIO res;
    String query_for_logging;
    try
    {
        
        if (context->hasQueryParameters())
        {
            ReplaceQueryParameterVisitor visitor(context->getQueryParameters());
            visitor.visit(ast);
            query = serializeAST(*ast);
        }
        
        
        
        query_for_logging = prepareQueryForLogging(query, context);
        logQuery(query_for_logging, context, internal);
        
        if (settings.enable_global_with_statement)
        {
            ApplyWithGlobalVisitor().visit(ast);
        }
        {
            SelectIntersectExceptQueryVisitor::Data data;
            SelectIntersectExceptQueryVisitor{data}.visit(ast);