{"id":612,"date":"2026-09-21T09:00:00","date_gmt":"2026-09-21T03:30:00","guid":{"rendered":"https:\/\/smitabharat.com\/blog\/go-database-interview-questions-part-20\/"},"modified":"2026-11-29T01:29:59","modified_gmt":"2026-11-28T19:59:59","slug":"go-database-interview-questions-part-20","status":"publish","type":"post","link":"https:\/\/smitabharat.com\/blog\/go-database-interview-questions-part-20\/","title":{"rendered":"Go Database Interview Questions: SQL and Caching (Part 20)"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">These Go database interview questions cover database\/sql, scanning rows, NULL values, transactions, the pool, pgx, sqlc, migrations and Redis. We gathered them from public interview lists, coding rounds and community threads. Then we rewrote them in plain words and grouped them by idea.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">This post is questions only, so answer each one in your own words first. When you need help, read <a href=\"https:\/\/smitabharat.com\/blog\/go-database-sql-tutorial\/\">Go database tutorial with database\/sql<\/a>, <a href=\"https:\/\/smitabharat.com\/blog\/go-postgresql-pgx\/\">Go PostgreSQL with pgx<\/a> and <a href=\"https:\/\/smitabharat.com\/blog\/go-redis-caching\/\">Go Redis caching<\/a>. Also, finish <a href=\"https:\/\/smitabharat.com\/blog\/go-rest-api-interview-questions-part-19\/\">Part 19 on HTTP and REST APIs<\/a> first, because most handlers end with a database call.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">How to Use These Go Database Interview Questions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Answer each of these Go database interview questions out loud, then try the hard ones against a local PostgreSQL in Docker. Database bugs often hide in rare paths, such as a NULL column or a rolled back transaction. Finally, try the scenario questions, since they come from real outages.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The table below lists each section and its number of questions.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Section<\/th><th>What it tests<\/th><th>Questions<\/th><\/tr><\/thead><tbody><tr><td>database\/sql basics<\/td><td>DB, drivers and context<\/td><td>15<\/td><\/tr><tr><td>Queries and NULLs<\/td><td>Scan, rows and Null types<\/td><td>15<\/td><\/tr><tr><td>Transactions<\/td><td>Begin, Commit, Rollback and isolation<\/td><td>14<\/td><\/tr><tr><td>Connection pool<\/td><td>Limits, timeouts and stats<\/td><td>14<\/td><\/tr><tr><td>Tools<\/td><td>pgx, sqlc, ORMs and migrations<\/td><td>14<\/td><\/tr><tr><td>Caching<\/td><td>Redis, TTL and cache-aside<\/td><td>14<\/td><\/tr><tr><td>Database coding tasks<\/td><td>Classic interview programs<\/td><td>10<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-database-interview-questions-part-20-diagram-1.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-database-interview-questions-part-20-diagram-1-1024x640.png\" alt=\"Go Database Interview Questions diagram showing six question areas from database\/sql to caching\" class=\"wp-image-581\" srcset=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-database-interview-questions-part-20-diagram-1-1024x640.png 1024w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-database-interview-questions-part-20-diagram-1-300x188.png 300w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-database-interview-questions-part-20-diagram-1-768x480.png 768w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-database-interview-questions-part-20-diagram-1-1536x960.png 1536w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-database-interview-questions-part-20-diagram-1-2048x1280.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">The six areas covered in this question list, from database\/sql to caching.<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Go Database Interview Questions on database\/sql<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before you answer, study <a href=\"https:\/\/smitabharat.com\/blog\/go-database-sql-tutorial\/\">Go database tutorial with database\/sql<\/a>. These Go database interview questions start with the standard package that every SQL driver plugs into.<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>What is database\/sql, and why does it need a separate driver?<\/li>\n\n\n<li>How does a blank import register a driver with sql.Register?<\/li>\n\n\n<li>What does sql.Open do, and why does it not connect right away?<\/li>\n\n\n<li>Why should you call db.PingContext after sql.Open?<\/li>\n\n\n<li>Is *sql.DB one connection or a pool, and is it safe for many goroutines?<\/li>\n\n\n<li>Why should you create one *sql.DB and share it across the app?<\/li>\n\n\n<li>What is the difference between QueryContext, QueryRowContext and ExecContext?<\/li>\n\n\n<li>Why should every call pass a context?<\/li>\n\n\n<li>How do placeholders differ between drivers, for example ? and $1?<\/li>\n\n\n<li>Why must you never build SQL with fmt.Sprintf and user input?<\/li>\n\n\n<li>What do prepared statements give you, and when are they worth it?<\/li>\n\n\n<li>What does sql.Result return after an insert or update?<\/li>\n\n\n<li>Does LastInsertId work with PostgreSQL, and what do you use instead?<\/li>\n\n\n<li>Scenario: when a new service opens a fresh *sql.DB in every handler, what goes wrong?<\/li>\n\n\n<li>Scenario: when a search box lets users inject SQL, how would you fix the query?<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Go Database Interview Questions on Queries and NULLs<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before you answer, study <a href=\"https:\/\/smitabharat.com\/blog\/go-sqlc-vs-gorm\/\">Go sqlc vs GORM<\/a>. Reading rows correctly is harder than it looks, so these Go database interview questions focus on the details.<\/p>\n\n\n\n<ol start=\"16\" class=\"wp-block-list\">\n<li>How do you loop over rows, and why must you call rows.Close?<\/li>\n\n\n<li>Why should you check rows.Err after the loop ends?<\/li>\n\n\n<li>What error does QueryRow return when no row matches, and how do you check it?<\/li>\n\n\n<li>Why does Scan need pointers to variables?<\/li>\n\n\n<li>What happens when you scan a NULL column into a plain string?<\/li>\n\n\n<li>How do sql.NullString and sql.NullInt64 work?<\/li>\n\n\n<li>What does the generic sql.Null type add in Go 1.22?<\/li>\n\n\n<li>When would you use a pointer field such as *string instead of a Null type?<\/li>\n\n\n<li>How do you scan a row into a struct without listing every field by hand?<\/li>\n\n\n<li>Why can SELECT * break your code when someone adds a column?<\/li>\n\n\n<li>How do you pass a list of IDs to an IN clause safely?<\/li>\n\n\n<li>What is the N plus 1 query problem, and how do you avoid it?<\/li>\n\n\n<li>How do you stream a large result set without loading it all into memory?<\/li>\n\n\n<li>Scenario: when a report endpoint leaks connections after an early return, what would you check?<\/li>\n\n\n<li>Scenario: when a profile page crashes on users with no phone number, how would you fix the scan?<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Go Database Interview Questions on Transactions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before you answer, study <a href=\"https:\/\/smitabharat.com\/blog\/go-postgresql-pgx\/\">Go PostgreSQL with pgx<\/a>. Transactions protect money and stock counts, so these Go database interview questions often come with follow-ups.<\/p>\n\n\n\n<ol start=\"31\" class=\"wp-block-list\">\n<li>How do you start a transaction with BeginTx, and what options can you pass?<\/li>\n\n\n<li>Why is defer tx.Rollback right after BeginTx a common pattern?<\/li>\n\n\n<li>What happens when you call Rollback after a successful Commit?<\/li>\n\n\n<li>Why must every query inside a transaction use tx and not db?<\/li>\n\n\n<li>What are the isolation levels, and which one is the PostgreSQL default?<\/li>\n\n\n<li>What problems do dirty reads, non-repeatable reads and phantom reads cause?<\/li>\n\n\n<li>How does SELECT FOR UPDATE help with a stock counter?<\/li>\n\n\n<li>What is optimistic locking with a version column?<\/li>\n\n\n<li>How do you retry a transaction after a serialization failure?<\/li>\n\n\n<li>Why should a transaction never wait on a slow HTTP call?<\/li>\n\n\n<li>How do you write a helper that runs a function inside a transaction?<\/li>\n\n\n<li>How do you keep a transaction and a message publish consistent, for example with an outbox table?<\/li>\n\n\n<li>Scenario: when two users buy the last item at the same time, how would you stop overselling?<\/li>\n\n\n<li>Scenario: when a money transfer debits one account but fails to credit the other, how would you fix it?<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Go Database Interview Questions on the Connection Pool<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before you answer, study <a href=\"https:\/\/smitabharat.com\/blog\/go-database-sql-tutorial\/\">Go database tutorial<\/a> again. Pool settings decide how a service behaves under load, so these Go database interview questions test real numbers.<\/p>\n\n\n\n<ol start=\"45\" class=\"wp-block-list\">\n<li>What do SetMaxOpenConns and SetMaxIdleConns control?<\/li>\n\n\n<li>Why is an unlimited number of open connections dangerous?<\/li>\n\n\n<li>What does SetConnMaxLifetime solve, for example with load balancers?<\/li>\n\n\n<li>What does SetConnMaxIdleTime do?<\/li>\n\n\n<li>How do you read pool numbers with db.Stats?<\/li>\n\n\n<li>What does WaitCount in the stats tell you?<\/li>\n\n\n<li>How do you size the pool for ten service replicas and one database?<\/li>\n\n\n<li>Why can a long transaction block other requests?<\/li>\n\n\n<li>How does a query timeout through context free a connection?<\/li>\n\n\n<li>When would you add a connection pooler such as PgBouncer?<\/li>\n\n\n<li>How do read replicas change the way you route queries?<\/li>\n\n\n<li>How do you find slow queries from a Go service?<\/li>\n\n\n<li>Scenario: when every request waits for a connection during a traffic spike, which stats would you check?<\/li>\n\n\n<li>Scenario: when the database says too many connections after a scale-up, how would you fix it?<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Go Database Interview Questions on Tools<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before you answer, study <a href=\"https:\/\/smitabharat.com\/blog\/go-sqlc-vs-gorm\/\">Go sqlc vs GORM<\/a> and <a href=\"https:\/\/smitabharat.com\/blog\/go-database-migrations\/\">Go database migrations<\/a>. Teams argue about tools, so these questions ask you to explain your trade-offs.<\/p>\n\n\n\n<ol start=\"59\" class=\"wp-block-list\">\n<li>What does pgx give you that database\/sql does not?<\/li>\n\n\n<li>When would you use pgxpool instead of database\/sql with the pgx driver?<\/li>\n\n\n<li>What does sqlc generate from SQL files?<\/li>\n\n\n<li>What are the pros and cons of an ORM such as GORM?<\/li>\n\n\n<li>Why do many Go teams prefer plain SQL over an ORM?<\/li>\n\n\n<li>What is a database migration, and why do you version it?<\/li>\n\n\n<li>Should migrations run at app start or in a separate step, and why?<\/li>\n\n\n<li>How do you write a migration that is safe to run on a live table?<\/li>\n\n\n<li>What is your plan when a bad migration reaches production?<\/li>\n\n\n<li>How do you test database code, with a real database in Docker or with mocks?<\/li>\n\n\n<li>Why do many teams use testcontainers-go for integration tests?<\/li>\n\n\n<li>How do you seed test data and clean it up between tests?<\/li>\n\n\n<li>Scenario: when adding a column locks a large table for minutes, how would you change the migration?<\/li>\n\n\n<li>Scenario: when a team wants to switch from GORM to sqlc, how would you plan the move?<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Caching with Redis<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before you answer, study <a href=\"https:\/\/smitabharat.com\/blog\/go-redis-caching\/\">Go Redis caching<\/a> and <a href=\"https:\/\/smitabharat.com\/blog\/go-in-memory-cache-ttl\/\">Go in-memory cache with TTL<\/a>. A cache can make a service fast or wrong, so these Go database interview questions test both sides.<\/p>\n\n\n\n<ol start=\"73\" class=\"wp-block-list\">\n<li>What is the cache-aside pattern, and when does the app fill the cache?<\/li>\n\n\n<li>How do you pick a TTL for a cached value, for example for prices?<\/li>\n\n\n<li>How do you invalidate a cache entry after an update?<\/li>\n\n\n<li>What is a cache stampede, and how does singleflight help?<\/li>\n\n\n<li>When should you cache a not found result?<\/li>\n\n\n<li>Why can a cache return stale data, and when is that acceptable?<\/li>\n\n\n<li>When is an in-memory cache better than Redis?<\/li>\n\n\n<li>How do you store a struct in Redis, as JSON or as a hash?<\/li>\n\n\n<li>How would you build a rate limiter with Redis?<\/li>\n\n\n<li>What happens to your service when Redis goes down?<\/li>\n\n\n<li>How do you set timeouts on Redis calls?<\/li>\n\n\n<li>How do you warm a cache after a deploy?<\/li>\n\n\n<li>Scenario: when users see an old price after an update, how would you fix the cache flow?<\/li>\n\n\n<li>Scenario: when a popular key expires and the database load spikes, what would you change?<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Go Database Interview Questions for Coding Rounds<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Before you answer, write each task by hand against a local database. Interviewers watch your error checks and your transaction handling, not only whether the code runs.<\/p>\n\n\n\n<ol start=\"87\" class=\"wp-block-list\">\n<li>Write a function that loads a user by ID and returns a clear not found error.<\/li>\n\n\n<li>List orders with pagination and close the rows properly.<\/li>\n\n\n<li>Insert an order and its items inside one transaction.<\/li>\n\n\n<li>Transfer money between two accounts with row locks.<\/li>\n\n\n<li>Write a repository interface and a fake for unit tests.<\/li>\n\n\n<li>Add a cache-aside layer in front of a user lookup.<\/li>\n\n\n<li>Write a migration that adds an index without long locks.<\/li>\n\n\n<li>Read a column that may be NULL with sql.Null.<\/li>\n\n\n<li>Scenario: when an interviewer asks you to design the tables for a library system, which tables and keys would you start with?<\/li>\n\n\n<li>Scenario: when a bulk import of one million rows is too slow, how would you speed it up?<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Code Reading Questions<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Read each program carefully and predict the output before you run it. Then explain the result in your own words.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport (\n    \"database\/sql\"\n    \"fmt\"\n)\n\nfunc main() {\n    var email sql.NullString\n    _ = email.Scan(nil)\n    fmt.Println(email.Valid, email.String == \"\")\n    _ = email.Scan(\"asha@example.com\")\n    fmt.Println(email.Valid, email.String)\n\n    var age sql.Null[int64]\n    _ = age.Scan(int64(31))\n    v, _ := age.Value()\n    fmt.Println(age.V, age.Valid, v)\n\n    var score sql.NullInt64\n    err := score.Scan(\"not a number\")\n    fmt.Println(err != nil, score.Valid)\n}<\/code><\/pre>\n\n\n\n<ol start=\"97\" class=\"wp-block-list\">\n<li>What do the first three lines print, and how does Valid change after each Scan?<\/li>\n\n\n<li>What does the last line print, and why should you always check the error from Scan?<\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\">The second program is a tiny cache-aside layer in front of a fake store.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>package main\n\nimport (\n    \"errors\"\n    \"fmt\"\n    \"time\"\n)\n\nvar ErrNoRows = errors.New(\"no rows\")\n\ntype store struct{ calls int }\n\nfunc (s *store) userName(id int) (string, error) {\n    s.calls++\n    if id == 1 {\n        return \"Asha\", nil\n    }\n    return \"\", ErrNoRows\n}\n\ntype cache struct {\n    data map[int]string\n    at   map[int]time.Time\n    ttl  time.Duration\n}\n\nfunc (c *cache) get(id int, now time.Time, db *store) (string, error) {\n    if v, ok := c.data[id]; ok &amp;&amp; now.Sub(c.at[id]) &lt; c.ttl {\n        return v, nil\n    }\n    v, err := db.userName(id)\n    if err != nil {\n        return \"\", fmt.Errorf(\"user %d: %w\", id, err)\n    }\n    c.data[id], c.at[id] = v, now\n    return v, nil\n}\n\nfunc main() {\n    db := &amp;store{}\n    c := &amp;cache{data: map[int]string{}, at: map[int]time.Time{}, ttl: time.Minute}\n    t0 := time.Date(2026, 9, 21, 9, 0, 0, 0, time.UTC)\n    for _, sec := range []int{0, 10, 59, 61} {\n        name, _ := c.get(1, t0.Add(time.Duration(sec)*time.Second), db)\n        fmt.Println(sec, name, db.calls)\n    }\n    _, err := c.get(2, t0, db)\n    _, err2 := c.get(2, t0, db)\n    fmt.Println(errors.Is(err, ErrNoRows), err2, db.calls)\n}<\/code><\/pre>\n\n\n\n<ol start=\"99\" class=\"wp-block-list\">\n<li>How many times does the store run for user 1, and why does the call at 61 seconds go to the store?<\/li>\n\n\n<li>Why does user 2 hit the store twice, and how would negative caching change that?<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\">Quick Revision Table for Go and SQL<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Use the table below as a final check before your interview. It lists the database\/sql calls you will use most.<\/p>\n\n\n\n<figure class=\"wp-block-table\"><table><thead><tr><th>Call<\/th><th>Returns<\/th><th>Watch out for<\/th><\/tr><\/thead><tbody><tr><td>QueryContext<\/td><td>*sql.Rows<\/td><td>Close rows and check rows.Err<\/td><\/tr><tr><td>QueryRowContext<\/td><td>*sql.Row<\/td><td>sql.ErrNoRows on no match<\/td><\/tr><tr><td>ExecContext<\/td><td>sql.Result<\/td><td>RowsAffected for updates<\/td><\/tr><tr><td>BeginTx<\/td><td>*sql.Tx<\/td><td>Defer Rollback, then Commit<\/td><\/tr><tr><td>SetMaxOpenConns<\/td><td>Nothing<\/td><td>Size it for every replica<\/td><\/tr><tr><td>db.Stats<\/td><td>sql.DBStats<\/td><td>WaitCount shows pool pressure<\/td><\/tr><\/tbody><\/table><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Also, many interviewers ask you to compare database\/sql and pgx directly. The diagram below shows the difference side by side.<\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><a href=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-database-interview-questions-part-20-diagram-2.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"640\" src=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-database-interview-questions-part-20-diagram-2-1024x640.png\" alt=\"Go database diagram comparing database\/sql with pgx\" class=\"wp-image-582\" srcset=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-database-interview-questions-part-20-diagram-2-1024x640.png 1024w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-database-interview-questions-part-20-diagram-2-300x188.png 300w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-database-interview-questions-part-20-diagram-2-768x480.png 768w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-database-interview-questions-part-20-diagram-2-1536x960.png 1536w, https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-database-interview-questions-part-20-diagram-2-2048x1280.png 2048w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><figcaption class=\"wp-element-caption\">database\/sql works with many databases, while pgx is built only for PostgreSQL and gives you more of its features.<\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Official Resources<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">These official pages explain the rules behind these questions.<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><a href=\"https:\/\/go.dev\/doc\/database\/\">Go documentation: Accessing relational databases<\/a><\/li>\n\n\n<li><a href=\"https:\/\/pkg.go.dev\/database\/sql\">Package database\/sql documentation<\/a><\/li>\n\n\n<li><a href=\"https:\/\/go.dev\/doc\/database\/execute-transactions\">Executing transactions<\/a><\/li>\n\n\n<li><a href=\"https:\/\/go.dev\/doc\/database\/manage-connections\">Managing connections<\/a><\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Quick Recap<\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>These Go database interview questions cover database\/sql, queries, transactions, the pool, tools and caching.<\/li>\n\n\n<li>One shared *sql.DB is a safe pool, so create it once and pass a context to every call.<\/li>\n\n\n<li>Close rows, check rows.Err and handle sql.ErrNoRows on purpose.<\/li>\n\n\n<li>Defer Rollback after BeginTx, and run every statement on the tx.<\/li>\n\n\n<li>Size the pool for all replicas, and watch WaitCount in db.Stats.<\/li>\n\n\n<li>Cache with a TTL, plan invalidation and protect hot keys from stampedes.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">What&#8217;s Next?<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">By now, you have Go database interview questions for SQL, transactions and caching. Study the answers in your own notes, then check them against the <a href=\"https:\/\/smitabharat.com\/blog\/go-interview-topics-study-guide\/\">Go interview topics study guide<\/a>.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Next up: <a href=\"https:\/\/smitabharat.com\/blog\/go-security-interview-questions-part-21\/\">Go security interview questions (Part 21)<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>These Go database interview questions cover database\/sql, scanning rows, NULL values, transactions, the pool, pgx, sqlc, migrations and Redis. We gathered them from public&hellip;<\/p>\n","protected":false},"author":1,"featured_media":580,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_swapz_level":"","_swapz_series_part":0,"_swapz_hide_toc":false,"_swapz_hide_featured":false,"_swapz_description":"","footnotes":""},"categories":[10],"tags":[80,46,95,11,70,73],"swapz_series":[],"class_list":["post-612","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-interview","tag-advanced","tag-go-database","tag-go-interview-questions","tag-go-lang","tag-go-postgresql","tag-go-redis"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v28.9 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Go Database Interview Questions: SQL and Caching<\/title>\n<meta name=\"description\" content=\"Practise 100 Go database interview questions on database\/sql, scanning, NULLs, transactions, connection pools, pgx, sqlc, migrations and Redis caching.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/smitabharat.com\/blog\/go-database-interview-questions-part-20\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Go Database Interview Questions: SQL and Caching\" \/>\n<meta property=\"og:description\" content=\"Practise 100 Go database interview questions on database\/sql, scanning, NULLs, transactions, connection pools, pgx, sqlc, migrations and Redis caching.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/smitabharat.com\/blog\/go-database-interview-questions-part-20\/\" \/>\n<meta property=\"og:site_name\" content=\"Smita Bharat - Blog\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-21T03:30:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-11-28T19:59:59+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-database-interview-questions-part-20-featured.png\" \/>\n\t<meta property=\"og:image:width\" content=\"2400\" \/>\n\t<meta property=\"og:image:height\" content=\"1260\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Smita\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Smita\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"11 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-database-interview-questions-part-20\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-database-interview-questions-part-20\\\/\"},\"author\":{\"name\":\"Smita\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/27a1b1067d396703215c54acedbfd339\"},\"headline\":\"Go Database Interview Questions: SQL and Caching (Part 20)\",\"datePublished\":\"2026-09-21T03:30:00+00:00\",\"dateModified\":\"2026-11-28T19:59:59+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-database-interview-questions-part-20\\\/\"},\"wordCount\":1956,\"publisher\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/27a1b1067d396703215c54acedbfd339\"},\"image\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-database-interview-questions-part-20\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/go-database-interview-questions-part-20-featured.png\",\"keywords\":[\"Advanced\",\"Go Database\",\"Go Interview Questions\",\"Go Lang\",\"Go PostgreSQL\",\"Go Redis\"],\"articleSection\":[\"Interview\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-database-interview-questions-part-20\\\/\",\"url\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-database-interview-questions-part-20\\\/\",\"name\":\"Go Database Interview Questions: SQL and Caching\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-database-interview-questions-part-20\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-database-interview-questions-part-20\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/go-database-interview-questions-part-20-featured.png\",\"datePublished\":\"2026-09-21T03:30:00+00:00\",\"dateModified\":\"2026-11-28T19:59:59+00:00\",\"description\":\"Practise 100 Go database interview questions on database\\\/sql, scanning, NULLs, transactions, connection pools, pgx, sqlc, migrations and Redis caching.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-database-interview-questions-part-20\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-database-interview-questions-part-20\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-database-interview-questions-part-20\\\/#primaryimage\",\"url\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/go-database-interview-questions-part-20-featured.png\",\"contentUrl\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/10\\\/go-database-interview-questions-part-20-featured.png\",\"width\":2400,\"height\":1260,\"caption\":\"Go Database Interview Questions featured image: query, transaction and cache cards\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/go-database-interview-questions-part-20\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Go Database Interview Questions: SQL and Caching (Part 20)\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/\",\"name\":\"Smita Bharat Blog\",\"description\":\"Golang &amp; Backend Development Tutorials and Interview Questions\",\"publisher\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/27a1b1067d396703215c54acedbfd339\"},\"alternateName\":\"Smita Bharat\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/27a1b1067d396703215c54acedbfd339\",\"name\":\"Smita\",\"logo\":{\"@id\":\"https:\\\/\\\/smitabharat.com\\\/blog\\\/#\\\/schema\\\/person\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/smitabharat.com\\\/blog\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Go Database Interview Questions: SQL and Caching","description":"Practise 100 Go database interview questions on database\/sql, scanning, NULLs, transactions, connection pools, pgx, sqlc, migrations and Redis caching.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/smitabharat.com\/blog\/go-database-interview-questions-part-20\/","og_locale":"en_US","og_type":"article","og_title":"Go Database Interview Questions: SQL and Caching","og_description":"Practise 100 Go database interview questions on database\/sql, scanning, NULLs, transactions, connection pools, pgx, sqlc, migrations and Redis caching.","og_url":"https:\/\/smitabharat.com\/blog\/go-database-interview-questions-part-20\/","og_site_name":"Smita Bharat - Blog","article_published_time":"2026-09-21T03:30:00+00:00","article_modified_time":"2026-11-28T19:59:59+00:00","og_image":[{"width":2400,"height":1260,"url":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-database-interview-questions-part-20-featured.png","type":"image\/png"}],"author":"Smita","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Smita","Est. reading time":"11 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/smitabharat.com\/blog\/go-database-interview-questions-part-20\/#article","isPartOf":{"@id":"https:\/\/smitabharat.com\/blog\/go-database-interview-questions-part-20\/"},"author":{"name":"Smita","@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/27a1b1067d396703215c54acedbfd339"},"headline":"Go Database Interview Questions: SQL and Caching (Part 20)","datePublished":"2026-09-21T03:30:00+00:00","dateModified":"2026-11-28T19:59:59+00:00","mainEntityOfPage":{"@id":"https:\/\/smitabharat.com\/blog\/go-database-interview-questions-part-20\/"},"wordCount":1956,"publisher":{"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/27a1b1067d396703215c54acedbfd339"},"image":{"@id":"https:\/\/smitabharat.com\/blog\/go-database-interview-questions-part-20\/#primaryimage"},"thumbnailUrl":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-database-interview-questions-part-20-featured.png","keywords":["Advanced","Go Database","Go Interview Questions","Go Lang","Go PostgreSQL","Go Redis"],"articleSection":["Interview"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/smitabharat.com\/blog\/go-database-interview-questions-part-20\/","url":"https:\/\/smitabharat.com\/blog\/go-database-interview-questions-part-20\/","name":"Go Database Interview Questions: SQL and Caching","isPartOf":{"@id":"https:\/\/smitabharat.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/smitabharat.com\/blog\/go-database-interview-questions-part-20\/#primaryimage"},"image":{"@id":"https:\/\/smitabharat.com\/blog\/go-database-interview-questions-part-20\/#primaryimage"},"thumbnailUrl":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-database-interview-questions-part-20-featured.png","datePublished":"2026-09-21T03:30:00+00:00","dateModified":"2026-11-28T19:59:59+00:00","description":"Practise 100 Go database interview questions on database\/sql, scanning, NULLs, transactions, connection pools, pgx, sqlc, migrations and Redis caching.","breadcrumb":{"@id":"https:\/\/smitabharat.com\/blog\/go-database-interview-questions-part-20\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/smitabharat.com\/blog\/go-database-interview-questions-part-20\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/smitabharat.com\/blog\/go-database-interview-questions-part-20\/#primaryimage","url":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-database-interview-questions-part-20-featured.png","contentUrl":"https:\/\/smitabharat.com\/blog\/wp-content\/uploads\/2026\/10\/go-database-interview-questions-part-20-featured.png","width":2400,"height":1260,"caption":"Go Database Interview Questions featured image: query, transaction and cache cards"},{"@type":"BreadcrumbList","@id":"https:\/\/smitabharat.com\/blog\/go-database-interview-questions-part-20\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/smitabharat.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Go Database Interview Questions: SQL and Caching (Part 20)"}]},{"@type":"WebSite","@id":"https:\/\/smitabharat.com\/blog\/#website","url":"https:\/\/smitabharat.com\/blog\/","name":"Smita Bharat Blog","description":"Golang &amp; Backend Development Tutorials and Interview Questions","publisher":{"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/27a1b1067d396703215c54acedbfd339"},"alternateName":"Smita Bharat","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/smitabharat.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/27a1b1067d396703215c54acedbfd339","name":"Smita","logo":{"@id":"https:\/\/smitabharat.com\/blog\/#\/schema\/person\/image\/"},"sameAs":["https:\/\/smitabharat.com\/blog"]}]}},"_links":{"self":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts\/612","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/comments?post=612"}],"version-history":[{"count":1,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts\/612\/revisions"}],"predecessor-version":[{"id":1002,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/posts\/612\/revisions\/1002"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/media\/580"}],"wp:attachment":[{"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/media?parent=612"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/categories?post=612"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/tags?post=612"},{"taxonomy":"swapz_series","embeddable":true,"href":"https:\/\/smitabharat.com\/blog\/wp-json\/wp\/v2\/swapz_series?post=612"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}