It shouldn't. It may have a minimal effect on compile time, but with CGI there's no reason to compile for each request. If you want to save time here, use stored procedures
instead of having the database server compile a query plan
over and over again.
Exporting is something done *once*, during compile time.
See question 1.
Keeping the SQL in each script has the advantage of
not having to modify another file if you need to change the
query.