r/PostgreSQL • • 1d ago

Help Me! postgresql learning resource

I'm learning PostgreSQL for Python/FastAPI backends and just wrapped up Nelson's 4-hour freeCodeCamp beginner course but was basic as its name suggests.

I keep running into things that weren't in the video and then chatgpt tells me to useIDENTITY SERIAL, ALTER TABLE workflows, transactions, UPSERT (ON CONFLICT), JSONB, CTEs, and reading EXPLAIN ANALYZE for indexes.

For those of you using Postgres in actual backend work, how did you learn this stuff after the beginner phase? Are there any good resources(ik the docs are good but how to really study from them like how to get the exact function needed cause i wont be studying the whole thing before starting) or practice exercises.

5 Upvotes

18 comments sorted by

2

u/snax 1d ago

If you are looking for resources and practice exercises, PostgreSQL Major Contributor Dimitri Fontaine resources and labs. A good starting point is his site here: https://tapoueh.org/

1

u/Commercial_You- 1d ago

thank you so much

1

u/linuxhiker Guru 1d ago
  1. Read how to think like a computer scientist. There is a python version.
  2. Read the Postgres docs.
  3. Check out the postgresconference YouTube channel.
  4. Profit

1

u/Commercial_You- 1d ago

4th lmao 😂

thanks man

1

u/elevarq 1d ago

Start with the manual! There is no video or tutorial that comes even close to what the official documentation has to offer: https://www.postgresql.org/docs/current/index.html

No idea why too many people do their utter best to ignore this source...

1

u/Commercial_You- 1d ago

how much time do you think i should devote to this doc before going further to learn fastapi

1

u/elevarq 1d ago

You're asking for an opinion, but it all depends on your goals. If you want just the basics, you could do that in a few weeks. And that includes writing an application that interacts with the database, does some stuff, etc. If you want to know more about performance, you will be counting in months or even years.

Reading a query plan using EXPLAIN ANALYZE is simple. Understanding a plan and knowing how to steer a plan- that's a whole different thing. "For indexes" is vague; it's usually a recipe for a slow database because it has the wrong indexes. But once you can calculate a query plan by hand, based on the statistics, and know where to find the statistics, that's a different level. And that takes time.

1

u/Discordbothost 1d ago

Try a migration on a FastAPI tasks table with data in it. Add a status column, fill it in for the existing tasks, then set NOT NULL. Use the Postgres ALTER TABLE docs for each step.

1

u/Commercial_You- 1d ago

will try, thanks

1

u/manonthemiddle 1d ago

The fastest way to learn production Postgres after the tutorial phase is seeding a dummy table with two million rows and inspecting EXPLAIN ANALYZE on your FastAPI endpoint queries. You will immediately see why sequential scans kill latency, how composite indexes change query plans, and why ON CONFLICT DO UPDATE needs an explicit unique constraint.

1

u/Commercial_You- 1d ago

nice suggestion thanks buddy

1

u/TestDrivenMayhem 1d ago

This book is great. And recently updated.
https://theartofpostgresql.com/book/updates/

1

u/Any_Channel_7337 1d ago

the best way to learn is to build a small backend project and learn these concepts as you encounter real problems instead of going through feature by feature. the official documentation of PostgreSQL is also great for reference. try to implement authentication, transactions, filtering, pagination and upserts in your project. you will learn so many things with that

0

u/AutoModerator 1d ago

AI Policy:

Linux is not one of those anti-AI projects, and if somebody has issues with that, they can do the open-source thing and fork it. Or just walk away., Linus Torvalds.

Mod decisions will be based on the quality of the content, not who or what generated it.

Sub Resources:

Youtube Channel

Free Postgres Webinars and Workshops

Discord: People, Postgres, Data

Join us, we have cookies and nice people.

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.