The DBI module, like other portable database interfaces, is layered. Figure 14.1 shows the structure of a Perl/DBI application.
The topmost layer is the Perl application. A Perl application uses the DBI module to interact with one or more database drivers in a driver-independent (and therefore, database-independent) fashion. DBI is an acronym for "database interface." DBD is an acronym for "database driver." You can think of the DBI module as "database independent" and the DBD module as "database dependent."
The DBI class is responsible for loading DBI drivers into the Perl runtime. The DBI can return a list of available drivers as well as a list of data sources available through a given driver. The DBI class is also responsible for creating database connections.
The DBD driver is the component that interfaces with the database. Notice that I've changed spelling here: DBI is the interface seen by the application; DBD is the interface seen by DBI.
The PostgreSQL DBI driver is known as DBD::Pg. DBD::Pg is a combination of Perl code and C code. In the future, you may see a pure Perl driver for PostgreSQL. Pure Perl drivers are much easier to install because you don't have to worry about finding a binary (that is, precompiled) distribution or compiling the driver yourself.
At the bottom of the heap, you'll find the actual database. The DBD driver translates client requests into the form required by the backend database and translates results into the form expected by the client application. The PostgreSQL driver connects to a PostgreSQL database using the libpq API.