Whenever you are running queries against the Illuminate database I ask that you set an application_name. This piece of information is useful to us because we see it in our logs and can identify where queries are coming from. Knowing where a query comes from is important when we look to optimize performance or decide to change the schema.

To set an application_name you can call the following command before any of your other queries (similar to the statement_timeout).

-- Set application_name to include my name, my tool and a
-- short description of what I am doing.
SET application_name TO 'zrankin via pgAdmin, experimenting with queries';

Examples

SET application_name TO 'zrankin via pgAdmin, experimenting with queries';
SET statement_timeout TO '1000';

SELECT student_id, last_name, first_name
FROM students
LIMIT 100;

When looking at the logs we will see something like this.

                application_name                 |                    query
-------------------------------------------------+-------------------------------------------
 zrankin via pgAdmin, experimenting with queries | SELECT student_id, last_name, first_name +
                                                 | FROM students                            +
                                                 | LIMIT 100;                               +