select message_id from s_relations into outfile '/tmp/messages_ids.csv' FIELDS TERMINATED BY ',';