The simple CGI case
A CGI script services a single request. So the baseline for CGI to
access a database is to open a connection, run any necessary queries,
close the connection, and return content to the Client.
This is fine for a low-traffic site, but grows inefficient as the
hit rate rises above a few tens per minute. So as traffic rises, an
alternative model is required. For CGI, we can use an alternative
implementation such as FastCGI. But the most widely-used architecture
is LAMP.