AI Hints
Home›PostgreSQL Tutorial›Interview Questions and Quiz
PostgreSQL · Lesson 117 of 120

Quick Quiz

Test yourself.

⏱ 2 min read▶ Video at 1:45:52🎓 Free
Watch this lesson in the PostgreSQL courseWatch on YouTube ↗Full PostgreSQL course

Three quick questions to check what you've learned. Pause on each one, choose your answer, then listen for the explanation.

  • Three questions
  • Pause
  • Check

Question 1

Question one. Which index type is best for searching inside a JSONB column with the contains operator? Pause and choose. The answer is B, GIN. It indexes every key and value inside the documents.

Quick check
Index for jsonb @> searches

Question 2

Question two. Two workers must each grab a different job from a jobs table. Which clause makes that safe? Pause and choose. The answer is D, for update skip locked. Each worker skips jobs already locked by another.

Quick check
Two workers, different jobs

Question 3

Question three. A query filters on date of viewed at, and ignores the index on viewed at. What's the best fix? Pause and choose. The answer is A. Rewrite it as a range on viewed at, so the index can be used.

Quick check
WHERE date(viewed_at) = ... ignores the index

Summary

Well done. Next, your Postgres cheat sheet.

Key takeaways
  • GIN
  • SKIP LOCKED
  • Ranges
Next up: Cheat Sheet — everything on one page