CodeRigor

LESSON

Compare embedded storage with a database server

Separate a process-owned SQLite file from an application-owned connection to a separately running server.

SQLite is embedded in the application process and commonly stores its database in an application-owned file. PostgreSQL is a separately running server reached through an explicit connection. Both support relational work, but their deployment, ownership and failure boundaries differ.

This course builds on relational design and Go packages/tests. You move an actual deterministic SQLite notes fixture into an owned local PostgreSQL cluster. Hosted tasks stay offline and test pure Go contracts; the downloadable lab performs the real database operations.

Compare embedded storage with a database server
start / 3
Separate a process-owned SQLite file from an application-owned connection to a separately running server.
Compare embedded storage with a database server
Separate a process-owned SQLite file from an application-owned connection to a separately running server.

With an embedded database, the application owns file location, connection lifetime and filesystem access. With a server, it also needs an explicit destination, authentication/role, connection budget and server lifecycle owner. A transaction is still necessary in either architecture.

The exercise names those boundaries without opening a file or connection. The local launcher handles the additional work with a new fixture directory and private socket. No public PostgreSQL endpoint or hosted network capability is introduced.

Go
package main
import ("fmt")
func main(){
fmt.Println("SQLite:","process + owned file")
fmt.Println("PostgreSQL:","application + connection + server")
}

A local server process can stop independently of your application. A connection can fail while the database files remain healthy. Conversely a process-owned file still needs a recovery and concurrency policy. Moving to a server changes responsibilities; it does not automatically improve every workload.

Keep application data separate from course progress or personal databases. The launcher creates only its own source.sqlite and PostgreSQL cluster and removes them after a confirmed stop. It never opens the site’s learner-state database.

Review source, target and evidence
start / 3
A successful migration includes typed values, actual database behavior and explicit cleanup.
Review source, target and evidence
A successful migration includes typed values, actual database behavior and explicit cleanup.
Go
package main
import ("fmt")
func main(){
fmt.Println("same relational intent, different lifetime boundary")
}

Implement the boundary description, then inspect the launcher’s explicit ownership choices. Next construct a connection URI that cannot silently fall back to another host.

Watch & read

Free lectures, talks and readings that cover this skill from another angle. All resources →

Optional database overview. The authored lessons and real local lab teach the exact schema, migration and application-lifetime boundaries used here.