Video yükleniyor...

Video Yüklenemedi

Ana Sayfaya Dön

How Postgres 17 improves IN queries In prior releases, postgres would loop and do multiple "primitive" index scans as many as your IN elements. In Postgres 17 it takes an array and eliminates the need for multiple scans. This only applies for constant values

143,703 görüntüleme • 2 yıl önce •via X (Twitter)

10 Yorum

Hussein Nasser profil fotoğrafı
Hussein Nasser2 yıl önce

btw the tool used in the video is the btree viewer from university of san francisco portal. should show up in google.

Shyam Kumar profil fotoğrafı
Shyam Kumar2 yıl önce

Thanks for the video, Hussein! Postgres really helped solve the issue.

Abdelrahman profil fotoğrafı
Abdelrahman2 yıl önce

Would it matter if the values in the IN operator is sorted as the index column or not?

Hussein Nasser profil fotoğrafı
Hussein Nasser2 yıl önce

it actually might, the “loop” to lookup and find can break fast faster. worth testing but will only be visible in large in list.

Mohammed Al-Sabaawi profil fotoğrafı
Mohammed Al-Sabaawi2 yıl önce

Is there a way to tell the algorithm that they are in adjacent pages (i.e a range query) so instead of making another search it could just add an offset and get the next item/page?

Hussein Nasser profil fotoğrafı
Hussein Nasser2 yıl önce

@Mohammed_allabd Not in postgres but SQL server has this hint actually FORCESEEK vs FORCESCAN

Zaher profil fotoğrafı
Zaher2 yıl önce

If I increase the page size, would it help improve IN query performance by fitting more elements in each page, given that each page holds an ID array and some concurrency metadata? Or would it come with trade-offs?

حسون profil fotoğrafı
حسون2 yıl önce

So the old method in random IN query would be faster? Cuz it doesn't check the leaf for other elements in "IN query" which is clearly won't find them

Hussein Nasser profil fotoğrafı
Hussein Nasser2 yıl önce

Worth testing, the question is does the extra lookup in the leaf page against the IN list adds much? Also we know the implementation always sorts IN list (not sure if this always was the case or mot), so we need to account for that too.

PrimeXBT PT profil fotoğrafı
PrimeXBT PT2 yıl önce

Ei, você encontrou o elixir mágico da eficiência tecnológica! 🚀 Assim como Adriana Lima desfila nas passarelas ou Al Capone fazia suas manobras, Postgres 17 tá na vida, trazendo uma evolução estilo Lambo nos IN queries. É como transformar scans primitivos em uma sinfonia otimizada! Agora é só adicionar um pouco de blockchain no loop e o future é nosso. HODL esse conhecimento! #TechRevolution #KeepBUIDLing 🌟

Benzer Videolar