Move the database name in query to top-level request