home.social

#psql — Public Fediverse posts

Live and recent posts from across the Fediverse tagged #psql, aggregated by home.social.

fetched live
  1. GIN‑индексы для JSONB в PostgreSQL: jsonb_ops vs jsonb_path_ops

    С JSONB в PostgreSQL есть одна довольно коварная ловушка: GIN‑индекс вроде бы поставили, запросы вроде бы работают, EXPLAIN не пугает — и на этом многие успокаиваются. Но как только данных становится действительно много, выясняется, что выбор между jsonb_ops и jsonb_path_ops — это не нюанс из документации, а вполне ощутимая разница в размере индекса, количестве лишних проверок и времени выполнения запросов. В этой статье разберём, как устроены оба оператор‑класса, почему один считается универсальным, а второй часто оказывается выгоднее на практике, и в каких случаях дефолтный выбор в PostgreSQL оказывается далеко не лучшим.

    habr.com/ru/companies/otus/art

    #psql #GINиндексы #JSONB #postgresql #jsonb_ops #jsonb_path_ops #индексация_JSONB #оптимизация_SQLзапросов #containment_operator

  2. GIN‑индексы для JSONB в PostgreSQL: jsonb_ops vs jsonb_path_ops

    С JSONB в PostgreSQL есть одна довольно коварная ловушка: GIN‑индекс вроде бы поставили, запросы вроде бы работают, EXPLAIN не пугает — и на этом многие успокаиваются. Но как только данных становится действительно много, выясняется, что выбор между jsonb_ops и jsonb_path_ops — это не нюанс из документации, а вполне ощутимая разница в размере индекса, количестве лишних проверок и времени выполнения запросов. В этой статье разберём, как устроены оба оператор‑класса, почему один считается универсальным, а второй часто оказывается выгоднее на практике, и в каких случаях дефолтный выбор в PostgreSQL оказывается далеко не лучшим.

    habr.com/ru/companies/otus/art

    #psql #GINиндексы #JSONB #postgresql #jsonb_ops #jsonb_path_ops #индексация_JSONB #оптимизация_SQLзапросов #containment_operator

  3. EXPLAIN ANALYZE в PostgreSQL: читаем планы выполнения экспертно

    Привет, Хабр! Запрос работает 30 секунд. Вы смотрите на него, всё вроде ок: JOIN по индексированным полям, WHERE по дате, LIMIT 100. Должен летать, но что-то не летает. Добавляете индекс наугад — не помогает. Переписываете подзапрос в CTE и стало ещё хуже. Проблема не в запросе, а в в том, что вы не смотрели в план выполнения. EXPLAIN ANALYZE показывает не что вы написали, а что PostgreSQL делает: какие индексы использует (и использует ли вообще), в каком порядке соединяет таблицы, где тратит время, сколько строк ожидал и сколько получил. Понять PostgreSQL

    habr.com/ru/companies/otus/art

    #explain #psql #PostgreSQL #план_выполнения #оптимизация_запросов #индексы_PostgreSQL #производительность_БД

  4. EXPLAIN ANALYZE в PostgreSQL: читаем планы выполнения экспертно

    Привет, Хабр! Запрос работает 30 секунд. Вы смотрите на него, всё вроде ок: JOIN по индексированным полям, WHERE по дате, LIMIT 100. Должен летать, но что-то не летает. Добавляете индекс наугад — не помогает. Переписываете подзапрос в CTE и стало ещё хуже. Проблема не в запросе, а в в том, что вы не смотрели в план выполнения. EXPLAIN ANALYZE показывает не что вы написали, а что PostgreSQL делает: какие индексы использует (и использует ли вообще), в каком порядке соединяет таблицы, где тратит время, сколько строк ожидал и сколько получил. Понять PostgreSQL

    habr.com/ru/companies/otus/art

    #explain #psql #PostgreSQL #план_выполнения #оптимизация_запросов #индексы_PostgreSQL #производительность_БД

  5. Advisory Locks в PostgreSQL: блокировки уровня приложения, о которых мало кто знает

    Привет, Хабр! PostgreSQL умеет блокировать строки ( SELECT ... FOR UPDATE ) и таблицы ( LOCK TABLE ). Об этом знают все. Но есть третий тип блокировок, который решает задачи, с которыми row-level и table-level locks не справляются: advisory locks. Консультативные блокировки — механизм, где PostgreSQL предоставляет инфраструктуру (атомарные блокировки с очередями ожидания), а семантику определяет приложение. Это значит: вы берёте блокировку по произвольному числовому ключу, и PostgreSQL гарантирует, что никто другой не возьмёт блокировку с тем же ключом одновременно. Никаких таблиц, строк или ресурсов БД не блокируется — это чисто логическая блокировка, видимая только тем, кто её проверяет. Звучит как-то абстрактно. Посмотрим на конкретные задачи, где advisory locks незаменимы.

    habr.com/ru/companies/otus/art

    #psql #advisory_locks #PostgreSQL_блокировки #блокировки_в_БД #конкурентный_доступ #идемпотентность #микросервисная_архитектура #распределённые_системы

  6. Advisory Locks в PostgreSQL: блокировки уровня приложения, о которых мало кто знает

    Привет, Хабр! PostgreSQL умеет блокировать строки ( SELECT ... FOR UPDATE ) и таблицы ( LOCK TABLE ). Об этом знают все. Но есть третий тип блокировок, который решает задачи, с которыми row-level и table-level locks не справляются: advisory locks. Консультативные блокировки — механизм, где PostgreSQL предоставляет инфраструктуру (атомарные блокировки с очередями ожидания), а семантику определяет приложение. Это значит: вы берёте блокировку по произвольному числовому ключу, и PostgreSQL гарантирует, что никто другой не возьмёт блокировку с тем же ключом одновременно. Никаких таблиц, строк или ресурсов БД не блокируется — это чисто логическая блокировка, видимая только тем, кто её проверяет. Звучит как-то абстрактно. Посмотрим на конкретные задачи, где advisory locks незаменимы.

    habr.com/ru/companies/otus/art

    #psql #advisory_locks #PostgreSQL_блокировки #блокировки_в_БД #конкурентный_доступ #идемпотентность #микросервисная_архитектура #распределённые_системы

  7. Had to do a maintenance on Immich, postgres cluster got disconnected from the operator (somehow?) and wouldn't scale past 1 replica anymore...

    And we don't like single points of failure here

    So first, descheduling the Immich pod, to avoid weird writes between last backup and actual DB shutdown

    Triggering a manual backup

    Deleting cluster

    Recovering cluster from last backup

    Woops, the shared library object name got renamed from vectorchord 0.3 to 0.4.3, now it's "vchord.so" instead of "vectors.so"

    Quick fix and boom, everything comes back up

    Restoring Argo auto sync and the cluster is all back up, distributed and shining

    When Backups, DevOps and GitOps come back in a smooth and clear motion ⭐

    #postgresql #postgres #cnpg #psql #selfhosted #selfhosting #homelab #k3s #kubernetes #linux #opensource #immich #vectorchord #backup #devops #argocd #gitops

  8. Had to do a maintenance on Immich, postgres cluster got disconnected from the operator (somehow?) and wouldn't scale past 1 replica anymore...

    And we don't like single points of failure here

    So first, descheduling the Immich pod, to avoid weird writes between last backup and actual DB shutdown

    Triggering a manual backup

    Deleting cluster

    Recovering cluster from last backup

    Woops, the shared library object name got renamed from vectorchord 0.3 to 0.4.3, now it's "vchord.so" instead of "vectors.so"

    Quick fix and boom, everything comes back up

    Restoring Argo auto sync and the cluster is all back up, distributed and shining

    When Backups, DevOps and GitOps come back in a smooth and clear motion ⭐

    #postgresql #postgres #cnpg #psql #selfhosted #selfhosting #homelab #k3s #kubernetes #linux #opensource #immich #vectorchord #backup #devops #argocd #gitops

  9. Had to do a maintenance on Immich, postgres cluster got disconnected from the operator (somehow?) and wouldn't scale past 1 replica anymore...

    And we don't like single points of failure here

    So first, descheduling the Immich pod, to avoid weird writes between last backup and actual DB shutdown

    Triggering a manual backup

    Deleting cluster

    Recovering cluster from last backup

    Woops, the shared library object name got renamed from vectorchord 0.3 to 0.4.3, now it's "vchord.so" instead of "vectors.so"

    Quick fix and boom, everything comes back up

    Restoring Argo auto sync and the cluster is all back up, distributed and shining

    When Backups, DevOps and GitOps come back in a smooth and clear motion ⭐

    #postgresql #postgres #cnpg #psql #selfhosted #selfhosting #homelab #k3s #kubernetes #linux #opensource #immich #vectorchord #backup #devops #argocd #gitops

  10. Had to do a maintenance on Immich, postgres cluster got disconnected from the operator (somehow?) and wouldn't scale past 1 replica anymore...

    And we don't like single points of failure here

    So first, descheduling the Immich pod, to avoid weird writes between last backup and actual DB shutdown

    Triggering a manual backup

    Deleting cluster

    Recovering cluster from last backup

    Woops, the shared library object name got renamed from vectorchord 0.3 to 0.4.3, now it's "vchord.so" instead of "vectors.so"

    Quick fix and boom, everything comes back up

    Restoring Argo auto sync and the cluster is all back up, distributed and shining

    When Backups, DevOps and GitOps come back in a smooth and clear motion ⭐

    #postgresql #postgres #cnpg #psql #selfhosted #selfhosting #homelab #k3s #kubernetes #linux #opensource #immich #vectorchord #backup #devops #argocd #gitops

  11. Tara, aralin natin ang window functions sa PostgreSQL! Sa video na ito (70) ipapakita kung paano gamitin ang OVER() kasama ang RANK() at DENSE_RANK() sa psql — praktikal sa terminal at workflows. Perfect para sa mga Pinoy devs at DBAs na gustong mag-level-up! #PostgreSQL #SQL #WindowFunctions #RANK #DENSE_RANK #psql #Linux #Pinoy #Tagalog
    apollo.lanofthedead.xyz/videos

  12. peertube upgrade done even wrote a nice markdown guide on how to do it, feel free to share :)

    #psql #peertube #sysadmin #postgres #docker
  13. 📋 #psql compatibility with familiar commands like \dt, \d, \dn, \l
    📜 Persistent query history with fuzzy search
    🍺 Easy install via #Homebrew, #Cargo or binary download

    github.com/fcoury/tsql

  14. 📋 #psql compatibility with familiar commands like \dt, \d, \dn, \l
    📜 Persistent query history with fuzzy search
    🍺 Easy install via #Homebrew, #Cargo or binary download

    github.com/fcoury/tsql

  15. 📋 #psql compatibility with familiar commands like \dt, \d, \dn, \l
    📜 Persistent query history with fuzzy search
    🍺 Easy install via #Homebrew, #Cargo or binary download

    github.com/fcoury/tsql

  16. 📋 #psql compatibility with familiar commands like \dt, \d, \dn, \l
    📜 Persistent query history with fuzzy search
    🍺 Easy install via #Homebrew, #Cargo or binary download

    github.com/fcoury/tsql

  17. So... most gnome apps are failing to open on my debian sid daily driver. So... pgadmin4 won't open to remotely edit my company database. So... I have learned how to add a column to a table in my remote database using psql locally. Yup, I'm a hacker.

    #postgres #postgresql #pgadmin #pgadmin4 #psql #debian #sid #debiansid #hacker

  18. So... most gnome apps are failing to open on my debian sid daily driver. So... pgadmin4 won't open to remotely edit my company database. So... I have learned how to add a column to a table in my remote database using psql locally. Yup, I'm a hacker.

    #postgres #postgresql #pgadmin #pgadmin4 #psql #debian #sid #debiansid #hacker

  19. So... most gnome apps are failing to open on my debian sid daily driver. So... pgadmin4 won't open to remotely edit my company database. So... I have learned how to add a column to a table in my remote database using psql locally. Yup, I'm a hacker.

    #postgres #postgresql #pgadmin #pgadmin4 #psql #debian #sid #debiansid #hacker

  20. So... most gnome apps are failing to open on my debian sid daily driver. So... pgadmin4 won't open to remotely edit my company database. So... I have learned how to add a column to a table in my remote database using psql locally. Yup, I'm a hacker.

    #postgres #postgresql #pgadmin #pgadmin4 #psql #debian #sid #debiansid #hacker

  21. Tomorrow: @swisspug & @tbussmann invite us to a presentation (Rapperswil + Online) on #psql-chat - ask #PostgreSQL questions in natural language, an SQL query or PSQL command is generated for faster interactive data analysis swisspug.org/#meetup_2025-12

  22. Tomorrow: @swisspug & @tbussmann invite us to a presentation (Rapperswil + Online) on -chat - ask questions in natural language, an SQL query or PSQL command is generated for faster interactive data analysis swisspug.org/#meetup_2025-12

  23. Tomorrow: @swisspug & @tbussmann invite us to a presentation (Rapperswil + Online) on #psql-chat - ask #PostgreSQL questions in natural language, an SQL query or PSQL command is generated for faster interactive data analysis swisspug.org/#meetup_2025-12

  24. Tomorrow: @swisspug & @tbussmann invite us to a presentation (Rapperswil + Online) on #psql-chat - ask #PostgreSQL questions in natural language, an SQL query or PSQL command is generated for faster interactive data analysis swisspug.org/#meetup_2025-12

  25. Today, trying to get the k3s cluster back to a working and smooth sailing state...

    It has been somewhat unstable since the moving, and with little time to take care of it, outages were around every corner

    Turns out, CNPG wasn't clearing out WAL on local replicas, inflating local disk usage, making them unavailable for scheduling...

    Now that I understand why everything goes down, it is time to setup ntfy and link with with alertmanager+prometheus to get proper insights on the cluster in realtime

    Now, back to rebuilding all Longhorn volumes because of those random outages *sight*

    But underlining the importance of having good backups ! Because no data was lost, despite random downtimes

    #k3s #devops #kubernetes #prometheus #alertmanager #cluster #cnpg #wal #postgres #psql #ntfy #longhorn #volume #backups #homelab #selfhosted

  26. Today, trying to get the k3s cluster back to a working and smooth sailing state...

    It has been somewhat unstable since the moving, and with little time to take care of it, outages were around every corner

    Turns out, CNPG wasn't clearing out WAL on local replicas, inflating local disk usage, making them unavailable for scheduling...

    Now that I understand why everything goes down, it is time to setup ntfy and link with with alertmanager+prometheus to get proper insights on the cluster in realtime

    Now, back to rebuilding all Longhorn volumes because of those random outages *sight*

    But underlining the importance of having good backups ! Because no data was lost, despite random downtimes

    #k3s #devops #kubernetes #prometheus #alertmanager #cluster #cnpg #wal #postgres #psql #ntfy #longhorn #volume #backups #homelab #selfhosted

  27. Today, trying to get the k3s cluster back to a working and smooth sailing state...

    It has been somewhat unstable since the moving, and with little time to take care of it, outages were around every corner

    Turns out, CNPG wasn't clearing out WAL on local replicas, inflating local disk usage, making them unavailable for scheduling...

    Now that I understand why everything goes down, it is time to setup ntfy and link with with alertmanager+prometheus to get proper insights on the cluster in realtime

    Now, back to rebuilding all Longhorn volumes because of those random outages *sight*

    But underlining the importance of having good backups ! Because no data was lost, despite random downtimes

    #k3s #devops #kubernetes #prometheus #alertmanager #cluster #cnpg #wal #postgres #psql #ntfy #longhorn #volume #backups #homelab #selfhosted

  28. Today, trying to get the k3s cluster back to a working and smooth sailing state...

    It has been somewhat unstable since the moving, and with little time to take care of it, outages were around every corner

    Turns out, CNPG wasn't clearing out WAL on local replicas, inflating local disk usage, making them unavailable for scheduling...

    Now that I understand why everything goes down, it is time to setup ntfy and link with with alertmanager+prometheus to get proper insights on the cluster in realtime

    Now, back to rebuilding all Longhorn volumes because of those random outages *sight*

    But underlining the importance of having good backups ! Because no data was lost, despite random downtimes

    #k3s #devops #kubernetes #prometheus #alertmanager #cluster #cnpg #wal #postgres #psql #ntfy #longhorn #volume #backups #homelab #selfhosted

  29. [Перевод] Как отследить трафик PostgreSQL

    Недавно я изучал детали реализации взаимодействия клиента PostgreSQL с базой данных и был удивлён, насколько легко просматривать трафик PostgreSQL с помощью wireshark. Когда я поделился своим удивлением в социальной сети, меня попросили привести пример того, как это сделать.

    habr.com/ru/companies/gnivc/ar

    #wireshark #sniffer #psql #protocol #бд #базы_данных #постгрес #sql

  30. [Перевод] Как отследить трафик PostgreSQL

    Недавно я изучал детали реализации взаимодействия клиента PostgreSQL с базой данных и был удивлён, насколько легко просматривать трафик PostgreSQL с помощью wireshark. Когда я поделился своим удивлением в социальной сети, меня попросили привести пример того, как это сделать.

    habr.com/ru/companies/gnivc/ar

    #wireshark #sniffer #psql #protocol #бд #базы_данных #постгрес #sql

  31. I was reminded, unfortunately, today that I still despise #psql

    It's like Microsoft Access f🤬d some old 1.0 version of mysql and from that jank, psql squelched out of the conjunction already completely batshit insane

    That's my guess... 🦥

  32. I was reminded, unfortunately, today that I still despise #psql

    It's like Microsoft Access f🤬d some old 1.0 version of mysql and from that jank, psql squelched out of the conjunction already completely batshit insane

    That's my guess... 🦥