PostgreSQL Library
TOPIC: Using DB-FIDDLE.com https://www.db-fiddle.com/f/7hPsTQ9pmowpgz3tnGFSc7/2
This specific fiddle actually has COMMENTS explaining how to use it!
And how the link changes.
I don't know how long that link sticks around!
And how the link changes.
I don't know how long that link sticks around!
Understanding Concurrency in PostgreSQL
Well worth reading:
https://www.postgresql.org/docs/current/mvcc.html
Well worth reading:
https://www.postgresql.org/docs/current/mvcc.html
PostgreSQL Documentation
Chapter 13. Concurrency Control
Chapter 13. Concurrency Control Table of Contents 13.1. Introduction 13.2. Transaction Isolation 13.2.1. Read Committed Isolation Level 13.2.2. Repeatable Read Isolation Level β¦
β€1
Things to AVOID Doing with PostgreSQL:
https://wiki.postgresql.org/wiki/Don%27t_Do_This
https://wiki.postgresql.org/wiki/Don%27t_Do_This
Training Videos [This will be broken down into a series, with some descriptions of level, quality]
This is Microsoft Azure Centric:
https://www.youtube.com/@azurelibacademy4673
This is Microsoft Azure Centric:
https://www.youtube.com/@azurelibacademy4673
PostgreSQL Library
Training Videos [This will be broken down into a series, with some descriptions of level, quality] This is Microsoft Azure Centric: https://www.youtube.com/@azurelibacademy4673
UDEMY has a PG Class that starts with installing PG... And covers the basics for the beginner.
https://www.udemy.com/course/advanced-sql-bootcamp/?utm_source=adwords&utm_medium=udemyads&utm_campaign=SQL_Search_la.EN_cc.US_PP_Control&utm_content=deal4584&utm_term=_._ag_141124575332_._ad_594266299839_._kw__._de_c_._dm__._pl__._ti_dsa-1652644802385_._li_9012017_._pd__._&matchtype=&gclid=CjwKCAiA2fmdBhBpEiwA4CcHzYtX_VgRqEEnkgvKD0PATxhVJX5aehUrzA9Dp8ssYCanCTHoKs8RihoCMmgQAvD_BwE
https://www.udemy.com/course/advanced-sql-bootcamp/?utm_source=adwords&utm_medium=udemyads&utm_campaign=SQL_Search_la.EN_cc.US_PP_Control&utm_content=deal4584&utm_term=_._ag_141124575332_._ad_594266299839_._kw__._de_c_._dm__._pl__._ti_dsa-1652644802385_._li_9012017_._pd__._&matchtype=&gclid=CjwKCAiA2fmdBhBpEiwA4CcHzYtX_VgRqEEnkgvKD0PATxhVJX5aehUrzA9Dp8ssYCanCTHoKs8RihoCMmgQAvD_BwE
Udemy
Advanced SQL Bootcamp
Take your SQL skills to the next level with our Advanced SQL Bootcamp
π1
Training:
Some here: https://proopensource.it/blog/learning-postgresql
some here: https://www.udemy.com/course/advanced-sql-bootcamp/?utm_source=adwords&utm_medium=udemyads&utm_campaign=SQL_Search_la.EN_cc.US_PP_Control&utm_content=deal4584&utm_term=_._ag_141124575332_._ad_594266299839_._kw__._de_c_._dm__._pl__._ti_dsa-1652644802385_._li_9012017_._pd__._&matchtype=&gclid=CjwKCAiA2fmdBhBpEiwA4CcHzYtX_VgRqEEnkgvKD0PATxhVJX5aehUrzA9Dp8ssYCanCTHoKs8RihoCMmgQAvD_BwE
Some here: https://proopensource.it/blog/learning-postgresql
some here: https://www.udemy.com/course/advanced-sql-bootcamp/?utm_source=adwords&utm_medium=udemyads&utm_campaign=SQL_Search_la.EN_cc.US_PP_Control&utm_content=deal4584&utm_term=_._ag_141124575332_._ad_594266299839_._kw__._de_c_._dm__._pl__._ti_dsa-1652644802385_._li_9012017_._pd__._&matchtype=&gclid=CjwKCAiA2fmdBhBpEiwA4CcHzYtX_VgRqEEnkgvKD0PATxhVJX5aehUrzA9Dp8ssYCanCTHoKs8RihoCMmgQAvD_BwE
proopensource.it
ProOpenSource OΓ Blog | Learning PostgreSQL
Where to learn PostgreSQL
π2
Window Functions (RANK, DENS RANK, LEAD/LAG)
https://www.youtube.com/watch?v=Ww71knvhQ-s
https://www.youtube.com/watch?v=Ww71knvhQ-s
YouTube
SQL Window Function | How to write SQL Query using RANK, DENSE RANK, LEAD/LAG | SQL Queries Tutorial
This video is about Window Functions in SQL which is also referred to as Analytic Function in some of the RDBMS. SQL Window Functions covered in this video are RANK, DENSE RANK, ROW NUMBER, LEAD, LAG. Also, we see how to use SQL Aggregate functions like MINβ¦
π5
How to get pastebin on your phone, and then use the QR Code feature of the browser, to get your text into a Telegram (or other chat)
https://pastebin.com/
https://pastebin.com/
Pastebin
Pastebin.com - #1 paste tool since 2002!
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Forwarded from Milos Eskert
fond this repo some time ago, has some nice tools:
https://github.com/Azmodey/pg_dba_scripts
https://github.com/Azmodey/pg_dba_scripts
GitHub
GitHub - Azmodey/pg_dba_scripts: PostgreSQL DBA scripts
PostgreSQL DBA scripts. Contribute to Azmodey/pg_dba_scripts development by creating an account on GitHub.
π2
For those who ask "Why Not Just use NUMERIC" versus BIGINT for keys.
I have a large table (5 billion+ rows). I freshly loaded this. And I created indexes.
One was (bigint,bigint) and another was (numeric, bigint).
3x longer to create the (numeric,bigint). And it was all basically I/O.
I started them both at the same time, to take advantage of reading the same file.
The first one was done in 8hrs.
The second one, was the only thing running on the machine. And it took an additional 16hrs to complete.
The size of your columns matter.
I have a large table (5 billion+ rows). I freshly loaded this. And I created indexes.
One was (bigint,bigint) and another was (numeric, bigint).
3x longer to create the (numeric,bigint). And it was all basically I/O.
I started them both at the same time, to take advantage of reading the same file.
The first one was done in 8hrs.
The second one, was the only thing running on the machine. And it took an additional 16hrs to complete.
The size of your columns matter.
π2
Do you have write queries that take forever to run?
This is an approach to Batch Based processing, with independent transactions.
And the ability to keep track and display a Progress Bar.
It leverages PSQL \watch to work it's magic...
Well worth reading.
https://postgres.ai/blog/20220114-progress-bar-for-postgres-queries-lets-dive-deeper
This is an approach to Batch Based processing, with independent transactions.
And the ability to keep track and display a Progress Bar.
It leverages PSQL \watch to work it's magic...
Well worth reading.
https://postgres.ai/blog/20220114-progress-bar-for-postgres-queries-lets-dive-deeper
PostgresAI
Progress bar for Postgres queries β let's dive deeper | PostgresAI
<div><img src="/assets/thumbnails/20220114-progress-bar-for-postgres-queries-lets-dive-deeper.png" alt="Progress bar for Postgres queries β let's dive deeper"/></div> <p>Recently, I have read a nice post titled <a href="https://www.brianlikespostgres.com/postgresβ¦
β€1
Deleting ONLY the duplicates (leaving 1 row behind), with full control over batch sizes.
I've seen this question come up NUMEROUS times in various forums.
I've based this implementation on the work of others. (@Nikoay_S)
This is a GOOD LEARNING PIECE.
This seems straight forward enough.
Effectively, you can limit the number of rows you have coming back.
I have it set to 100 here.
The trick is HAVING count(1) > 1. This means each time you run, you will get at new set to work with.
Notice the way this runs, using the \WATCH command as a loop. (but it's an infinite loop. Version 16 of psql has iteration control!) [Also, this means it doesn't work in GUI tools]
Each iteration is it's own transaction. When you are done, the table is bloated (it should be vacuumed).
[I guess you could also use ROW_NUMBER OVER (PARTITION) rn ... WHERE rn > 1)]
I've seen this question come up NUMEROUS times in various forums.
I've based this implementation on the work of others. (@Nikoay_S)
This is a GOOD LEARNING PIECE.
This seems straight forward enough.
Effectively, you can limit the number of rows you have coming back.
I have it set to 100 here.
The trick is HAVING count(1) > 1. This means each time you run, you will get at new set to work with.
Notice the way this runs, using the \WATCH command as a loop. (but it's an infinite loop. Version 16 of psql has iteration control!) [Also, this means it doesn't work in GUI tools]
Each iteration is it's own transaction. When you are done, the table is bloated (it should be vacuumed).
[I guess you could also use ROW_NUMBER OVER (PARTITION) rn ... WHERE rn > 1)]
β SETUP
drop table if exists big;
create temp table big ( other_val int );
insert into big select gs % 1000 + 1 from generate_series(1, 5000000) as gs;
create index on big (other_val);
vacuum analyze big;
DELETE from big
USING (select count(1) as cnt, other_val, min(ctid) as min_ctid from big group by other_val having count(1)>1 order by other_val desc limit 100) as dupes
where big.Other_val = dupes.other_val AND big.ctid > dupes.min_ctid;
\watch 0.5β€4
Things to consider when Converting from Oracle to Postgresql
This is going to be a CHAT conversation of knowledge to help others.
This is going to be a CHAT conversation of knowledge to help others.
π2π1
PITR For Beginners!
https://www.highgo.ca/2023/05/09/various-restoration-techniques-using-postgresql-point-in-time-recovery/
https://www.highgo.ca/2023/05/09/various-restoration-techniques-using-postgresql-point-in-time-recovery/
Highgo Software Inc. - Enterprise PostgreSQL Solutions
Various Restoration Techniques Using PostgreSQL Point-In-Time Recovery - Highgo Software Inc.
Introduction This blog is aimed at beginners trying to learn the basics of PostgreSQL but already have some experience under their belt. For this tutorial, we will assume you have PostgreSQL correctly installed on Ubuntu. All of these steps were done usingβ¦
PostgreSQL Library
Window Functions (RANK, DENS RANK, LEAD/LAG) https://www.youtube.com/watch?v=Ww71knvhQ-s
Adding some More Ideas...
https://www.youtube.com/watch?v=FsUcaPJlYjY&list=PLS-kiDL9KrIh-E5eadtnp-8l55H7e2LN0
https://www.youtube.com/watch?v=wByi8mk8JWg&list=PLxtrcgLvnR2Zx2h4VYqCkwIb_vQ6WKp3L
https://www.youtube.com/watch?v=nyQ_MVmKcgE&list=PLk1kxccoEnNHlAR2ggnzIkOc7jxqI-_w2
https://www.youtube.com/watch?v=-pUTNi2MStQ&list=PLVISlbl_zTWI00-tis9dkCguVUxFUPOcK
https://www.youtube.com/watch?v=mdMfOYn-H4I&list=PLH8y1BNPAKjI8DOvNV-qKmhokO_oeICnO
https://www.youtube.com/watch?v=FsUcaPJlYjY&list=PLS-kiDL9KrIh-E5eadtnp-8l55H7e2LN0
https://www.youtube.com/watch?v=wByi8mk8JWg&list=PLxtrcgLvnR2Zx2h4VYqCkwIb_vQ6WKp3L
https://www.youtube.com/watch?v=nyQ_MVmKcgE&list=PLk1kxccoEnNHlAR2ggnzIkOc7jxqI-_w2
https://www.youtube.com/watch?v=-pUTNi2MStQ&list=PLVISlbl_zTWI00-tis9dkCguVUxFUPOcK
https://www.youtube.com/watch?v=mdMfOYn-H4I&list=PLH8y1BNPAKjI8DOvNV-qKmhokO_oeICnO
YouTube
PostgreSQL Advanced SQL Queries and Data Analysis | Kae Kae | IT Education Series | 2022 | 1/8
PostgreSQL Advanced SQL Queries and Data Analysis:
PostgreSQL is a powerful, open-source object-relational database system with over 35 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance.β¦
PostgreSQL is a powerful, open-source object-relational database system with over 35 years of active development that has earned it a strong reputation for reliability, feature robustness, and performance.β¦