<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>SQL Conjuror</title>
	<atom:link href="https://sqlconjuror.com/feed/" rel="self" type="application/rss+xml" />
	<link>https://sqlconjuror.com/</link>
	<description>MySQL, PostgreSQL, MariaDB, Redis, Elasticsearch, TiDB, SQL Server, Oracle</description>
	<lastBuildDate>Fri, 16 Oct 2026 14:16:33 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2020/04/cropped-magichat3-1.jpg?fit=32%2C32&#038;ssl=1</url>
	<title>SQL Conjuror</title>
	<link>https://sqlconjuror.com/</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">101567825</site>	<item>
		<title>CapoSpin im direkten Vergleich</title>
		<link>https://sqlconjuror.com/capospin-im-direkten-vergleich-de6ca340/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=capospin-im-direkten-vergleich-de6ca340</link>
		
		<dc:creator><![CDATA[Enrique]]></dc:creator>
		<pubDate>Fri, 16 Oct 2026 14:16:33 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://sqlconjuror.com/?p=3546</guid>

					<description><![CDATA[<p>Capospin Casino im Test: Wir prüfen das Spielangebot, die Boni bis 1500 Euro und die Auszahlungsgeschwindigkeit für Spieler aus Deutschland. <a class="continue-reading-link" href="https://sqlconjuror.com/capospin-im-direkten-vergleich-de6ca340/"> Continue reading</a></p>
<p>The post <a href="https://sqlconjuror.com/capospin-im-direkten-vergleich-de6ca340/">CapoSpin im direkten Vergleich</a> first appeared on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
<p>The post <a href="https://sqlconjuror.com/capospin-im-direkten-vergleich-de6ca340/">CapoSpin im direkten Vergleich</a> appeared first on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Wir schauen uns die Plattformen genau an, bevor wir eine Empfehlung aussprechen. Dabei geht es nicht um bunte Versprechungen, sondern um harte Fakten. Wie schnell kommt das Geld? Ist das Spielangebot fair? Und wie steht es um die Sicherheit? In diesem Bericht nehmen wir CapoSpin unter die Lupe. Die Marke tritt international auf und wirbt mit einem breiten Portfolio und schnellen Transaktionen. Für Spieler, die Wert auf Effizienz legen, ist das ein wichtiger Punkt. Wir testen die Funktionen selbst und berichten aus der Praxis.</p>
<p><img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/i.ibb.co/VcgZf2Lg/pies-2ff35caca9d6.webp?w=920&#038;ssl=1" alt="CapoSpin im direkten Vergleich"></p>
<p>Die Registrierung ist der erste Schritt. Hier zeigen sich oft die ersten Hürden oder Vorteile. Bei dieser Plattform läuft der Prozess standardisiert ab. Man gibt die persönlichen Daten ein und bestätigt die E-Mail-Adresse. Wichtig ist dabei der Hinweis auf die Verifizierung. Ohne abgeschlossene KYC-Prüfung sind Auszahlungen blockiert. Das ist branchenüblich, aber hier wird es strikt gehandhabt. Dokumente wie Reisepass oder Stromrechnung müssen vorliegen. Die Bearbeitung dauert laut Angaben rund 24 Stunden. Wer das bedenkt, vermeidet Frust später. Ein direkter Link zum <a href="https://casinocapospin.com/">Capospin Casino</a> führt zur offiziellen Seite, wo man diese Schritte direkt starten kann. So hat man den Überblick von Beginn an.</p>
<h2>Das Angebot an Spielen</h2>
<p>Die Auswahl entscheidet oft über den Verbleib auf einer Plattform. Hier finden wir eine massive Bandbreite vor. Über 6.000 Spiele sollen verfügbar sein. Diese Zahl ist beeindruckend, doch Qualität zählt mehr als Quantität. Wir haben die Kategorien geprüft. Slots dominieren das Bild. Von klassischen Fruchtmaschinen bis zu modernen Video-Slots mit komplexen Mechaniken ist alles dabei. Anbieter wie Pragmatic Play, NetEnt und Evolution Gaming sind vertreten. Das garantiert einen gewissen Standard in Grafik und Sound.</p>
<p>Besonders hervorzuheben ist der Bereich der Live-Casino-Spiele. Hier treten echte Dealer gegen die Spieler an. Roulette, Blackjack und Baccarat werden in hoher Auflösung gestreamt. Die Interaktion funktioniert flüssig. Auch exotischere Varianten wie Crazy Time oder Lightning Roulette sind integriert. Für Fans von Tischspielen gibt es zudem digitale Versionen. Poker, Blackjack und Roulette lassen sich auch ohne Live-Dealer spielen. Die Software läuft stabil auf Desktop und Mobilgeräten. Eine dedizierte App ist verfügbar, muss aber nicht zwingend genutzt werden. Die mobile Web-Version ist voll funktionsfähig und passt sich dem Bildschirm an.</p>
<p>Ein weiterer Pluspunkt ist die Vielfalt der Provider. Neben den großen Namen wie Microgaming und Play&#8217;n GO finden sich auch Nischenanbieter wie BGaming oder Hacksaw Gaming. Das sorgt für Abwechslung. Neue Titel kommen regelmäßig hinzu. Die Suche funktioniert gut, Filter helfen bei der Orientierung. Man kann nach Anbietern, nach Popularität oder nach Neuheiten sortieren. Das spart Zeit. Wer spezifische Spiele wie Book of Dead oder Gates of Olympus sucht, findet sie sofort. Die Demo-Funktion ist implizit vorhanden, auch wenn sie nicht überall explizit beworben wird. So kann man Strategien testen, ohne echtes Geld zu riskieren.</p>
<h2>Boni und Konditionen</h2>
<p>Geld ist ein sensibles Thema. Wir achten genau auf die Bedingungen. Der Willkommensbonus ist attraktiv gestaltet. Er verteilt sich auf die ersten drei Einzahlungen. Insgesamt sind bis zu 1.500 Euro und 250 Freispiele möglich. Die erste Einzahlung wird mit 100 Prozent bis 500 Euro verdoppelt. Dazu gibt es 150 Freispiele. Die Mindesteinzahlung liegt bei 20 Euro. Das ist ein fairer Einstieg. Allerdings gibt es Einschränkungen. Die Umsatzbedingungen liegen bei x35 für den Bonusbetrag. Das ist marktüblich, aber man muss es schaffen. Die Gültigkeit beträgt sieben Tage. Das ist knapp. Wer wenig Zeit hat, sollte vorsichtig sein.</p>
<p>Die Freispiele gelten für ausgewählte Slots wie Platinum Lightning Deluxe. Gewinne aus diesen Spielen sind auf 50 Euro begrenzt. Das klingt wenig, ist aber bei No-Deposit- oder Low-Deposit-Angeboten normal. Wichtig ist der maximale Einsatz. Mit aktivem Bonus darf man nur 5 Euro pro Spin setzen. Bei Live-Spielen sind es 10 Euro. Wer dagegen verstößt, riskiert die Stornierung des Bonus und der Gewinne. Das System erkennt solche Verstöße automatisch. Wir raten zur Vorsicht. Lieber klein spielen und die Bedingungen erfüllen, als alles zu verlieren.</p>
<p>Neben dem Startpaket gibt es regelmäßige Aktionen. Der Sonntag-Reload ist eine feste Größe. Je nach VIP-Level erhält man zwischen 25 und 50 Prozent Bonus auf Einzahlungen am Sonntag. Die Codes variieren, von RELDAY bis RELOAD. Auch das wöchentliche Cashback ist erwähnenswert. Es berechnet sich auf die Verluste der Vorwoche. Der Prozentsatz steigt mit dem eigenen Level. Bis zu 25 Prozent sind möglich, allerdings nur auf Einladung. Für normale Spieler liegen die Werte zwischen 5 und 12,5 Prozent. Die Auszahlung dieses Cashbacks unterliegt nur einer einfachen Umsatzbedingung von x1. Das ist sehr kundenfreundlich. Finnische Spieler sind von diesem Angebot ausgeschlossen, was auf länderspezifische Regelungen hindeutet.</p>
<h2>Zahlungen und Sicherheit</h2>
<p>Vertrauen entsteht durch transparente Prozesse. Bei den Zahlungsmethoden setzt die Plattform auf eine Mischung aus klassischen und modernen Wegen. Kreditkarten von Visa und Mastercard werden akzeptiert. Auch Sofortüberweisung ist verfügbar. Für viele deutsche Spieler ist das ein wichtiger Faktor, da es direkt vom Bankkonto abgebucht wird. Kryptowährungen wie Bitcoin, Ethereum und Tether sind ebenfalls integriert. Das ermöglicht anonyme und schnelle Transaktionen. Die Mindesteinzahlung liegt bei 20 Euro. Das ist niedrig genug für Gelegenheitsspieler.</p>
<p>Bei den Auszahlungen sieht es etwas anders aus. Hier stehen Banküberweisungen und Krypto zur Verfügung. Die Bearbeitungszeit intern kann bis zu 72 Stunden dauern. Das ist länger als bei einigen Konkurrenten, die innerhalb von Stunden auszahlen. Sobald das Geld die Plattform verlässt, hängt die Dauer von der Methode ab. Krypto-Auszahlungen gehen oft innerhalb von 24 Stunden durch. Banküberweisungen können länger dauern und Gebühren von Zwischenbanken verursachen. Die Limits sind klar definiert. Pro Transaktion sind maximal 1.000 Euro möglich. Täglich sind es 2.500 Euro, wöchentlich 7.500 Euro und monatlich 15.000 Euro. Für High Roller ist das eventuell zu wenig, es sei denn, sie erreichen höhere VIP-Stufen.</p>
<p>Die Sicherheit wird durch SSL-Verschlüsselung gewährleistet. Das ist Standard. Doch das Casino geht weiter. Es gibt ein dediziertes Betrugsbekämpfungsteam und 24/7-Netzwerküberwachung. KYC-Prozesse sind streng. Drei Stufen der Due-Diligence werden angewendet. Das schützt sowohl die Plattform als auch die Spieler vor Geldwäsche. Datenschutz wird ernst genommen. Personenbezogene Daten werden verschlüsselt und gemäß den Gesetzen behandelt. Spieler haben das Recht auf Löschung ihrer Daten. Das zeigt ein Bewusstsein für die Privatsphäre. Dennoch fehlt eine europäische Lizenz wie die der GGL. Die Lizenz stammt aus Costa Rica oder Curacao, je nach Quelle. Das bedeutet weniger regulatorischen Schutz für den Spieler im Falle eines Streits. Man muss der Marke vertrauen.</p>
<h2>Sportwetten im Fokus</h2>
<p>Nicht nur Casino-Spieler kommen hier auf ihre Kosten. Der Sportwetten-Bereich ist umfangreich. Über 30 Sportarten werden angeboten. Fußball, Tennis und Basketball stehen im Mittelpunkt. Aber auch E-Sports und Randsportarten sind vertreten. Die Wettarten sind vielfältig. 1X2, Over/Under und Handicap sind Standard. Der Bet Builder erlaubt individuelle Kombinationen. Live-Wetten funktionieren in Echtzeit. Die Quoten passen sich dynamisch an. Grafiken zeigen den Spielverlauf an. Das hilft bei der Entscheidung. Ein Livestream ist jedoch nicht integriert. Man muss sich auf die Daten verlassen.</p>
<p>Ein interessantes Feature ist der ComboBoost. Ab vier Ereignissen in einer Kombiwette wird der Gewinn multipliziert. Die Mindestquote pro Ereignis liegt bei 1,30. Bei 16 Wetten steigt der Multiplikator auf das 1,5-fache. Das kann den Gewinn erheblich steigern. Allerdings ist das Risiko hoch. Alle Tipps müssen richtig sein. Der Sportwetten-Bonus ist separat zu betrachten. Er bietet 100 Prozent bis 100 Euro auf die erste Einzahlung. Die Umsatzbedingung liegt bei x5, aber nur über Kombiwetten umsetzbar. Die Mindestquote pro Wette ist 1,4, die Gesamtquote muss 2,75 betragen. Das ist machbar, erfordert aber Strategie.</p>
<p>Der Kundensupport ist auch hier relevant. Bei Fragen zu Wetten oder Auszahlungen muss Hilfe schnell kommen. Der Live-Chat ist 24/7 erreichbar. Die Antwortzeit liegt unter einer Minute. Zunächst antwortet ein Chatbot, der bei komplexeren Problemen an menschliche Mitarbeiter weiterleitet. Das ist effizient. E-Mail-Support ist ebenfalls vorhanden, reagiert aber langsamer. Telefonischer Support wird nicht explizit angeboten, außer im Rahmen der KYC-Verifikation. Die Sprachen umfassen Deutsch, Englisch und andere europäische Sprachen. Das macht die Kommunikation einfach. FAQ-Kategorien decken die häufigsten Probleme ab. Von Kontoverwaltung bis zu Bonusbedingungen ist alles dokumentiert.</p>
<h2>Fazit und Empfehlung</h2>
<p>Wir fassen zusammen. CapoSpin bietet ein solides Paket für Spieler, die Vielfalt suchen. Die 6.000 Spiele sind ein starkes Argument. Die Boni sind großzügig, aber die Bedingungen sind strikt. Wer die Regeln beachtet, kann profitieren. Das wöchentliche Cashback ist ein echtes Highlight, da es nur geringe Umsatzanforderungen hat. Die Auszahlungslimits von monatlich 15.000 Euro sind für die meisten Spieler ausreichend. Nur Profis stoßen hier an Grenzen. Die fehlende EU-Lizenz ist ein Wermutstropfen. Man bewegt sich in einer Grauzone. Der Schutz durch die GGL oder ähnliche Behörden fehlt. Man ist auf die Fairness des Betreibers angewiesen.</p>
<p>Die technischen Aspekte überzeugen. Die App läuft stabil, die Website ist responsiv. Die Zahlungsmethoden decken die Bedürfnisse deutscher Spieler ab, auch wenn Sofortüberweisung statt Giropay dominiert. Die Verifizierung ist nervig, aber notwendig für die Sicherheit. Wer geduldig ist und gerne spielt, findet hier ein Zuhause. Die VIP-Programmstruktur motiviert zum Weiterspielen. Vom Bronze- bis zum Platin-Level gibt es klare Vorteile. Besonders die höheren Stufen bieten persönliche Manager und höhere Limits. Das lohnt sich für Vielspieler.</p>
<p>Unsere Empfehlung lautet: Probieren Sie es aus, aber bleiben Sie realistisch. Setzen Sie nur Geld ein, das Sie verlieren können. Nutzen Sie die Demomodi, um die Spiele kennenzulernen. Achten Sie auf die Bonusbedingungen, besonders auf die Maximal-Einsätze. Und vergessen Sie nicht die Verifizierung frühzeitig anzustoßen, um Verzögerungen bei der Auszahlung zu vermeiden. CapoSpin ist keine Wundermaschine, aber eine funktionierende Plattform mit viel Inhalt. Für den gelegentlichen Spaß und die Jagd nach großen Gewinnen ist es einen Blick wert. Die Mischung aus Casino und Sportwetten macht es flexibel. Bleiben Sie informiert und spielen Sie verantwortungsbewusst.</p>The post <a href="https://sqlconjuror.com/capospin-im-direkten-vergleich-de6ca340/">CapoSpin im direkten Vergleich</a> first appeared on <a href="https://sqlconjuror.com">SQL Conjuror</a>.<p>The post <a href="https://sqlconjuror.com/capospin-im-direkten-vergleich-de6ca340/">CapoSpin im direkten Vergleich</a> appeared first on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3546</post-id>	</item>
		<item>
		<title>Fedezd fel a SlimKing Kaszinó Előnyeit és Nyerési Stratégiáit</title>
		<link>https://sqlconjuror.com/fedezd-fel-a-slimking-kaszino-elonyeit-es-nyeresi-strategiait/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=fedezd-fel-a-slimking-kaszino-elonyeit-es-nyeresi-strategiait</link>
		
		<dc:creator><![CDATA[Enrique]]></dc:creator>
		<pubDate>Thu, 15 Oct 2026 11:20:12 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://sqlconjuror.com/?p=3540</guid>

					<description><![CDATA[<p>Bevezetés: Egy élmény, amit sosem felejt el Képzeld el, hogy egy nyugodt estén felkelsz az asztaltól, és megnyitod a kedvenc online kaszinó oldalad, a https://slimking-hu.com/. A képernyőn színes nyerőgépek és izgalmas játékok várnak rád, miközben egyre növekvő bankrollod teszi még élvezetesebbé a játékot. Az online kaszinók világában a siker nem ... <a class="continue-reading-link" href="https://sqlconjuror.com/fedezd-fel-a-slimking-kaszino-elonyeit-es-nyeresi-strategiait/"> Continue reading</a></p>
<p>The post <a href="https://sqlconjuror.com/fedezd-fel-a-slimking-kaszino-elonyeit-es-nyeresi-strategiait/">Fedezd fel a SlimKing Kaszinó Előnyeit és Nyerési Stratégiáit</a> first appeared on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
<p>The post <a href="https://sqlconjuror.com/fedezd-fel-a-slimking-kaszino-elonyeit-es-nyeresi-strategiait/">Fedezd fel a SlimKing Kaszinó Előnyeit és Nyerési Stratégiáit</a> appeared first on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2 class="wp-block-heading">Bevezetés: Egy élmény, amit sosem felejt el</h2>



<p class="wp-block-paragraph">Képzeld el, hogy egy nyugodt estén felkelsz az asztaltól, és megnyitod a kedvenc online kaszinó oldalad, a <strong>https://slimking-hu.com/</strong>. A képernyőn színes nyerőgépek és izgalmas játékok várnak rád, miközben egyre növekvő bankrollod teszi még élvezetesebbé a játékot. Az online kaszinók világában a siker nem csupán szerencse kérdése, hanem tudatos stratégia is. Ha szeretnéd maximalizálni nyerési esélyeidet és élvezni a játék minden pillanatát, olvasd tovább, és fedezd fel a <strong>SlimKing kaszinó</strong> valódi előnyeit, valamint a nyerési stratégiák kulcsait.</p>



<h2 class="wp-block-heading">1. Ismerd meg alaposan a játékokat és a szabályokat</h2>



<p class="wp-block-paragraph">Az első lépés a sikerhez a megfelelő tudás megszerzése. A <strong>https://slimking-hu.com/</strong> oldal számos különféle játékot kínál, mint például nyerőgépeket, rulettet vagy blackjack-et. Minden játék saját szabályokkal és stratégiákkal rendelkezik, amelyeket érdemes alaposan megtanulni, mielőtt valódi pénzt teszel fel. Az online kaszinók felületek általában részletes leírásokat, demó módokat kínálnak, így gyakorolhatsz anélkül, hogy valódi kockázatot vállalnál. Minél mélyebben ismered a játékokat, annál nagyobb eséllyel tudod kihasználni a játék adta lehetőségeket, és minimalizálni a veszteségeket.</p>



<h2 class="wp-block-heading">2. Állíts be határokat és kezelj okosan a bankrolloddal</h2>



<p class="wp-block-paragraph">Az egyik legfontosabb tanács a felelős játékhoz, hogy mindig határozd meg, mennyit vagy hajlandó kockáztatni egy adott játékban. It&#8217;s also worth exploring <a href="https://slimking-hu.com/">https://slimking-hu.com/</a> for more. A <strong>https://slimking-hu.com/</strong> oldal biztonságos környezetet biztosít, de a saját pénzügyi fegyelmed az, ami igazán számít. Határozz meg napi, heti vagy havi költségkeretet, és tartsd magad hozzá. Ez segít elkerülni a túlzott veszteséget és megőrizni a játék örömét. Emellett javasolt a nyeremény határok kijelölése is, így ha eléri a kitűzött célodat, bátran abbahagyhatod a játékot, és élvezheted a megnyert összeget.</p>



<h2 class="wp-block-heading">3. Használd ki a kaszinó promócióit és bónuszait</h2>



<p class="wp-block-paragraph">A <strong>https://slimking-hu.com/</strong> rendszeresen kínál különféle promóciókat, bónuszokat és akciókat, amelyek jelentősen növelhetik nyerési esélyeidet. Ezek lehetnek befizetési bónuszok, ingyenes pörgetések vagy hűségprogramok, melyekkel hosszabb távon is nyereségesen játszhatsz. Érdemes időről időre figyelemmel kísérni ezeket a lehetőségeket, és okosan kihasználni őket. A bónuszok igénybevétele által növelheted a kockázatmentes játék idejét és az esetleges nyereményedet, így még több élményt szerezhetsz a kaszinó világában.</p>



<h2 class="wp-block-heading">Motiváló zárógondolat: A siker kulcsa a tudatos játékban rejlik</h2>



<p class="wp-block-paragraph">Az online kaszinók izgalmas világában a szerencse mellett a felkészültség és a stratégiák is meghatározzák az eredményt. A <strong>https://slimking-hu.com/</strong> oldal a legjobb lehetőségeket kínálja azok számára, akik nemcsak élvezni szeretnék a játékot, hanem nyerni is kívánnak. Emeld magasba tudásodat és önuralmadat, és élvezd minden pillanatát ennek a változatos és dinamikus világnak! Ne feledd: a legjobb nyeremények azoké lesznek, akik okosan és felelősségteljesen játszanak.</p>The post <a href="https://sqlconjuror.com/fedezd-fel-a-slimking-kaszino-elonyeit-es-nyeresi-strategiait/">Fedezd fel a SlimKing Kaszinó Előnyeit és Nyerési Stratégiáit</a> first appeared on <a href="https://sqlconjuror.com">SQL Conjuror</a>.<p>The post <a href="https://sqlconjuror.com/fedezd-fel-a-slimking-kaszino-elonyeit-es-nyeresi-strategiait/">Fedezd fel a SlimKing Kaszinó Előnyeit és Nyerési Stratégiáit</a> appeared first on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3540</post-id>	</item>
		<item>
		<title>der casino butler fürs kleine budget</title>
		<link>https://sqlconjuror.com/der-casino-butler-furs-kleine-budget-b6af25af/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=der-casino-butler-furs-kleine-budget-b6af25af</link>
		
		<dc:creator><![CDATA[Enrique]]></dc:creator>
		<pubDate>Thu, 15 Oct 2026 09:46:05 +0000</pubDate>
				<category><![CDATA[Uncategorized]]></category>
		<guid isPermaLink="false">https://sqlconjuror.com/?p=3538</guid>

					<description><![CDATA[<p>Casino Butler hilft Schweizer Spielern mit minimalen Budgets, klugen Bonusstrategien und legalen Casinos in der Schweiz. <a class="continue-reading-link" href="https://sqlconjuror.com/der-casino-butler-furs-kleine-budget-b6af25af/"> Continue reading</a></p>
<p>The post <a href="https://sqlconjuror.com/der-casino-butler-furs-kleine-budget-b6af25af/">der casino butler fürs kleine budget</a> first appeared on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
<p>The post <a href="https://sqlconjuror.com/der-casino-butler-furs-kleine-budget-b6af25af/">der casino butler fürs kleine budget</a> appeared first on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>ich spiele nicht mit viel geld rum, und das ist auch gut so. in der schweiz gibt es genug casinos mit konzession, die trotzdem was für leute wie mich haben. der casino butler zeigt mir, wo ich ohne grossen einzahlungsschein oder komplizierte bonusbedingungen spielen kann. kein bluff, kein ausländischer mist, nur legale seiten mit postfinance oder twint. das ist schon mal die halbe miete.</p>
<p><img data-recalc-dims="1" decoding="async" src="https://i0.wp.com/i.ibb.co/MxKqqKXw/pies-c42e5f2ac855.png?w=920&#038;ssl=1" alt="der casino butler fürs kleine budget"></p>
<p>die meisten anbieter wollen dich mit 1000 franken locken, aber wer hat das schon rumliegen? ich suche nach min-depots und fassbaren bonusregeln. der casino butler kennt die lage und spart mir die zeit, selbst zu suchen. das ist kein marketing-spruch, sondern einfach nur praktisch.</p>
<p>wenn du wie ich mit 50 oder 100 franken startest, willst du nicht noch extra gebühren zahlen. die echten kosten verstecken sich oft in den kleinen dingen: gebühren für einzahlungen, versteckte wetterbedingungen oder bonusgeld, das nie frei wird. der casino butler filtert das raus und zeigt dir, wo du wirklich ohne ärger spielen kannst.</p>
<p>die schweiz hat ihre eigenen regeln, und die sind nicht schlecht. nur konzessionierte casinos dürfen hier anbieten, ausländische seiten werden gesperrt. das ist zwar manchmal nervig, aber wenigstens weiss man, woran man ist. der casino butler arbeitet nur mit diesen casinos zusammen und spart dir die mühe, selbst zu prüfen.</p>
<p>ich will nicht stundenlang bonusbedingungen lesen, bis mir die augen bluten. der casino butler fasst zusammen, was wirklich zählt: wie viel muss ich einzahlen, um den bonus zu bekommen? wie oft muss ich wetten, bis ich das geld nutzen kann? und vor allem: gibt es fassbare freispiele ohne komische klauseln? das ist kein luxus, sondern überlebenswichtig für kleine bankrollen.</p>
<h2>was bringt der kleinste einzahlungsschein wirklich</h2>
<p>nehmen wir mal an, du willst mit 20 franken starten. viele casinos verlangen mindestens 10 oder 20 franken als depot. klingt wenig, aber wenn du drei casinos ausprobierst, sind das schnell 60 franken, die du nicht mehr hast. der casino butler zeigt dir, wo du mit weniger startest oder sogar ohne depot spielst.</p>
<p>ein typischer bonus für neue spieler gibt dir zum beispiel 100% auf dein depot bis 100 franken. wenn du 20 franken einzahlst, kriegst du 20 franken bonus. aber Achtung: oft musst du das 30-fache wetten, bevor du das geld abheben kannst. bei 20 franken bonus sind das 600 franken, die du setzen musst. das ist für kleine bankrollen einfach nicht machbar.</p>
<p>der casino butler filtert solche fälle raus und zeigt dir nur casinos, bei denen die wetterbedingungen fair sind. manchmal gibt es auch freispiele ohne depot, aber die haben oft niedrige höchsteinsätze. das ist kein geschenk, sondern ein lockmittel für leute, die nicht viel riskieren wollen.</p>
<p>wichtig ist auch die auszahlungsmethode. wenn du mit postfinance oder twint einzahlst, willst du das geld auch so zurückbekommen. manche casinos verlangen gebühren für auszahlungen oder haben minimale beträge. der casino butler prüft das für dich und spart dir böse überraschungen.</p>
<p>am ende zählt nicht der bonus selbst, sondern was du davon hast. wenn du 20 franken bonus bekommst, aber nie frei spielen kannst, ist das kein bonus, sondern ein fake. der casino butler zeigt dir die realen chancen, nicht die versprechen.</p>
<h2>der bonuswert für kleine bankrollen</h2>
<p>ein bonus ist nur so viel wert wie die chance, ihn auch zu nutzen. bei kleinen einzahlungen geht es oft um freispiele statt um geldboni. ein freispiel mit 10 franken höchsteinsatz ist für mich brauchbar, eines mit 100 franken schon nicht mehr.</p>
<p>der casino butler bewertet, wie viel wert ein bonus wirklich hat. manchmal gibt es 50 freispiele auf einen bestimmten slot, aber der höchsteinsatz pro spin ist lächerlich niedrig. dann kannst du zwar spielen, aber der gewinn bleibt minimal. das ist kein geschenk, sondern ein zeitfresser.</p>
<p>bei geldboni ist die sache einfacher: wenn du 100% auf 20 franken bekommst, hast du 40 franken zum spielen. aber wenn du das 35-fache wetten musst, sind das 1400 franken umsatz. das schaffst du mit 20 franken nicht in einem leben. der casino butler filtert solche bonis raus und zeigt dir nur die, die für kleine bankrollen sinn machen.</p>
<p>manchmal gibt es auch bonusgeld, das sofort frei ist. das klingt verlockend, aber meistens gibt es klauseln wie «nur gültig für bestimmte spiele». wenn du dann auf einem slot landest, der nicht zählt, hast du trotzdem nichts gewonnen. der casino butler prüft solche feinheiten und spart dir die enttäuschung.</p>
<p>am ende geht es darum, ob der bonus dir hilft, deine bankrolle zu verlängern oder nicht. wenn du mit 50 franken startest und nach einer stunde nur noch 20 hast, war der bonus kein hilfe, sondern ein betrug. der casino butler zeigt dir, wo du wirklich eine chance hast.</p>
<h2>wie man mit 50 franken möglichst lange spielt</h2>
<p>der einfachste trick ist, nicht alles auf einmal zu setzen. wenn du mit 50 franken startest, teilst du das in fünf teile à 10 franken. jedes mal, wenn du gewinnst, nimmst du einen teil und spielst weiter. verlierst du, nimmst du den nächsten teil und fängst von vorne an. so hast du fünf chancen, statt nur eine.</p>
<p>freispiele sind gut, aber nur wenn sie wirklich frei sind. manche casinos geben freispiele, die du nur nutzen kannst, wenn du vorher eine einzahlung machst. das ist kein geschenk, sondern ein marketing-trick. der casino butler zeigt dir, wo freispiele ohne bedingungen zu haben sind.</p>
<p>wichtig ist auch, die spielregeln zu kennen. bei roulette oder blackjack gibt es klare strategien, die deine chancen verbessern. bei slots ist das anders – da zählt nur das glück. aber auch hier gibt es spiele mit besserer auszahlungsquote. der casino butler gibt dir tipps, welche spiele für kleine bankrollen sinn machen.</p>
<p>auszahlungen sollten immer kostenlos sein. wenn ein casino für auszahlungen gebühren verlangt, ist das ein zeichen, dass sie dir das geld nicht gönnen. der casino butler filtert solche casinos raus und zeigt dir nur die, die fair spielen.</p>
<p>und schliesslich: spiel nicht unter druck. wenn du merkst, dass du verlierst, hör auf. kleine bankrollen sind schnell aufgebraucht, und kein bonus der welt bringt sie zurück. der casino butler erinnert dich daran, dass spass im vordergrund stehen sollte, nicht das gewinnen.</p>
<h2>die besten casinos für min-depots in der schweiz</h2>
<p>in der schweiz gibt es nicht unendlich viele casinos, aber die, die es gibt, sind alle konsequent. das heisst, du musst nicht auf ausländische seiten ausweichen, nur weil sie mehr bonus versprechen. der casino butler arbeitet nur mit den lizenzierten casinos zusammen und zeigt dir, wo du sicher und fair spielen kannst.</p>
<p>ein beispiel ist mycasino. dort kannst du mit 10 franken starten und bekommst freispiele ohne depot. die wetterbedingungen sind fair, und auszahlungen gehen schnell über postfinance. das ist kein luxus-casino, aber genau das richtige für kleine bankrollen.</p>
<p>swiss4win ist ein anderes casino, das auf schweizer spieler setzt. hier gibt es oft bonusgeld für neue spieler, aber die bedingungen sind transparent. du weisst genau, was du bekommst und was du tun musst, um es zu nutzen. das ist selten heutzutage.</p>
<p>wichtig ist auch, dass die casinos keine versteckten gebühren haben. manche verlangen gebühren für einzahlungen oder haben minimale auszahlungsbeträge. der casino butler prüft das für dich und spart dir die bösen überraschungen.</p>
<p>am ende geht es darum, dass du mit deinem geld auskommst. wenn ein casino dir hilft, deine bankrolle zu verlängern, statt sie schnell leer zu saugen, dann ist das ein gutes casino. der casino butler zeigt dir genau diese casinos und filtert den rest raus.</p>
<h2>bonusstrategien für leute mit kleinem budget</h2>
<p>der erste schritt ist immer, die bonusbedingungen genau zu lesen. wenn da steht, dass du das 40-fache wetten musst, bevor du das geld abheben kannst, ist das ein zeichen, dass der bonus nicht für dich gemacht ist. der casino butler fasst solche informationen für dich zusammen und spart dir die zeit.</p>
<p>freispiele sind gut, aber nur wenn sie wirklich frei sind. manche casinos geben freispiele, die du nur nutzen kannst, wenn du vorher eine einzahlung machst. das ist kein geschenk, sondern ein marketing-trick. der casino butler zeigt dir, wo freispiele ohne bedingungen zu haben sind.</p>
<p>ein weiterer trick ist, mehrere kleine einzahlungen zu machen statt einer grossen. wenn du zum beispiel 20 franken einzahlst, gewinnst und dann nochmal 20 franken, hast du mehr spielgeld als wenn du alles auf einmal setzt. das erhöht deine chancen, ohne dein budget zu sprengen.</p>
<p>wichtig ist auch, die spielzeiten zu nutzen. manche casinos haben promotions zu bestimmten tagen, bei denen die wetterbedingungen besser sind. der casino butler erinnert dich daran und zeigt dir, wann du deine chancen maximieren kannst.</p>
<p>und schliesslich: vergiss nicht, dass auszahlungen immer kostenlos sein sollten. wenn ein casino für auszahlungen gebühren verlangt, ist das ein zeichen, dass sie dir das geld nicht gönnen. der casino butler filtert solche casinos raus und zeigt dir nur die, die fair spielen.</p>
<h2>was der casino butler anders macht</h2>
<p>die meisten bonus-seiten werfen dir eine liste von casinos vor die füsse und sagen: «hier, such dir was aus». der casino butler geht einen schritt weiter und filtert für dich raus, was wirklich passt. das spart zeit und nerven, besonders wenn du wie ich nicht stundenlang bonusbedingungen lesen willst.</p>
<p>der casino butler arbeitet nur mit konsequentierten casinos in der schweiz. das heisst, du musst dir keine gedanken machen, ob das casino legal ist oder nicht. die netzsperren gegen ausländische seiten sind zwar manchmal nervig, aber wenigstens weiss man, woran man ist.</p>
<p>ausserdem zeigt dir der casino butler nicht nur die bonis, sondern auch die realen chancen. ein bonus, der 100% verspricht, aber nie frei wird, ist kein bonus – das ist ein fake. der casino butler bewertet, was wirklich wert ist, und spart dir die enttäuschung.</p>
<p>und schliesslich erinnert dich der casino butler daran, dass spass im vordergrund stehen sollte. kein bonus der welt bringt dein geld zurück, wenn du verlierst. der casino butler gibt dir tipps, wie du mit deinem budget möglichst lange spielen kannst, ohne dich zu verrückt zu machen.</p>
<p>das ist kein marketing-spruch, sondern einfach nur praktisch. wenn du wie ich mit kleinem budget spielst, brauchst du jemanden, der dir die faulen casinos und die falschen versprechen zeigt. der casino butler macht genau das – ohne bluff, ohne bullshit.</p>
<p>und wenn du mal nicht weiterweissst, findest du auf <a href="https://casinobutler.ch/">https://casinobutler.ch/</a> alles, was du brauchst, um mit deinem kleinen budget durchzustarten.</p>The post <a href="https://sqlconjuror.com/der-casino-butler-furs-kleine-budget-b6af25af/">der casino butler fürs kleine budget</a> first appeared on <a href="https://sqlconjuror.com">SQL Conjuror</a>.<p>The post <a href="https://sqlconjuror.com/der-casino-butler-furs-kleine-budget-b6af25af/">der casino butler fürs kleine budget</a> appeared first on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3538</post-id>	</item>
		<item>
		<title>PostgreSQL &#8211; Checkpoint</title>
		<link>https://sqlconjuror.com/postgresql-checkpoint/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=postgresql-checkpoint</link>
					<comments>https://sqlconjuror.com/postgresql-checkpoint/#respond</comments>
		
		<dc:creator><![CDATA[Enrique]]></dc:creator>
		<pubDate>Thu, 07 Dec 2023 05:44:35 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[Performance Optimization]]></category>
		<guid isPermaLink="false">https://sqlconjuror.com/?p=3467</guid>

					<description><![CDATA[<p>What is Checkpoint? Checkpoint periodically flushes all dirty buffers and creates checkpoint record in the WAL log, which is used for recovery. The purpose of the checkpoint is to ensure that all the dirty buffers generated up to a certain point are sent to the disk. This will recycle the ... <a class="continue-reading-link" href="https://sqlconjuror.com/postgresql-checkpoint/"> Continue reading</a></p>
<p>The post <a href="https://sqlconjuror.com/postgresql-checkpoint/">PostgreSQL – Checkpoint</a> first appeared on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
<p>The post <a href="https://sqlconjuror.com/postgresql-checkpoint/">PostgreSQL &#8211; Checkpoint</a> appeared first on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p class="wp-block-paragraph"><strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">What is Checkpoint?</mark></strong></p>



<p class="wp-block-paragraph">Checkpoint periodically flushes all dirty buffers and creates checkpoint record in the WAL log, which is used for recovery.</p>



<p class="wp-block-paragraph">The purpose of the <strong>checkpoint </strong>is to ensure that all the dirty buffers generated up to a certain point are sent to the disk. This will recycle the WAL up to that point. <span><a onclick="read_toggle(1430736737, 'Read More', 'Read Less'); return false;" class="read-link" id="readlink1430736737" style="readlink" href="#">Read More</a></span>
<div class="read_div" id="read1430736737" style="display: none;"></p>



<p class="wp-block-paragraph"><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color"><strong>Journey of a PostgreSQL Write</strong></mark></p>



<figure class="wp-block-image size-full"><img data-recalc-dims="1" fetchpriority="high" decoding="async" width="850" height="748" src="https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/12/image-1.png?resize=850%2C748&#038;ssl=1" alt="" class="wp-image-3482" srcset="https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/12/image-1.png?w=850&amp;ssl=1 850w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/12/image-1.png?resize=300%2C264&amp;ssl=1 300w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/12/image-1.png?resize=768%2C676&amp;ssl=1 768w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/12/image-1.png?resize=398%2C350&amp;ssl=1 398w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/12/image-1.png?resize=150%2C132&amp;ssl=1 150w" sizes="(max-width: 850px) 100vw, 850px" /></figure>



<p class="wp-block-paragraph"><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color"><strong>BG Writer (Background Writer)</strong></mark></p>



<p class="wp-block-paragraph">The BGWriter helps to diminish the I/O operations needed to be done by Checkpoints. This stabilizes the system&#8217;s I/O. BGWriter writes Dirty Buffers to disk when the system load is low to minimize the impact on active transactions. It constantly monitors the DB Buffer Pol and makes decisions on when to write dirty buffers to disk and which buffers to free up for reuse. </p>



<p class="wp-block-paragraph"><strong><mark style="background-color:rgba(0, 0, 0, 0)" class="has-inline-color has-vivid-red-color">Frequency of Checkpoints</mark></strong></p>



<p class="wp-block-paragraph">Use the below query to find the frequency of the checkpoints:</p>



<pre style="font-family: consolas; font-size: 16px;">
WITH sub as (
  SELECT 
    EXTRACT(
      EPOCH 
      FROM 
        (now() - stats_reset)
    ) AS seconds_since_start, 
    (
      checkpoints_timed + checkpoints_req
    ) AS total_checkpoints 
  FROM 
    pg_stat_bgwriter
) 
SELECT 
  total_checkpoints, 
  seconds_since_start / total_checkpoints / 60 AS minutes_between_checkpoints 
FROM 
  sub;

</pre>



<p class="wp-block-paragraph">There are two important columns <strong>checkpoints_req</strong>, <strong>checkpoints_timed</strong>.</p>



<p class="wp-block-paragraph">If the checkpoints_req is more than the checkpoints_timed, PostgreSQL is doing checkpoints due to the high WAL generation.</p>



<p class="wp-block-paragraph">If the checkpoints are happening frequently it will cause more IO load on the machine so increase the max_wal_size parameter.</p>



<p class="wp-block-paragraph">checkpoints_req &gt; checkpoints_timed = <strong>(bad)</strong>. This means that PostgreSQL is doing checkpoints due to the high WAL generation</p>



<p class="wp-block-paragraph">The basic rule is simple – <strong>checkpoints_timed</strong> value should be much higher than <strong>checkpoints_req</strong>. It’s best when the last one (checkpoints_req) is near zero. It may be obtained by increasing max_wal_size (or checkpoint_segments) and checkpoint_timeout. A good initial point is to set <strong>max_wal_size to 10GB</strong> and <strong>checkpoint_timeout = 30min</strong>. Also, checkpoint_completion_target should be configured in a way that will enable spread of execution of checkpoints to a time that is the closest to timeout or to the size of collected WAL. A good starting point for this is 0.9 (default in PostgreSQL 14 and above). Thus, with these settings checkpoint will occur when Postgres collects 10GB of WAL, or after 30 minutes from the last checkpoint. The already running checkpoint’s execution will spread over 27 minutes or until Postgres again collects 9GB of WAL.</p>



<p class="wp-block-paragraph">Cheers! </div></p>The post <a href="https://sqlconjuror.com/postgresql-checkpoint/">PostgreSQL – Checkpoint</a> first appeared on <a href="https://sqlconjuror.com">SQL Conjuror</a>.<p>The post <a href="https://sqlconjuror.com/postgresql-checkpoint/">PostgreSQL &#8211; Checkpoint</a> appeared first on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlconjuror.com/postgresql-checkpoint/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3467</post-id>	</item>
		<item>
		<title>PostgreSQL &#8211; Error: Canceling statement due to conflict with recovery</title>
		<link>https://sqlconjuror.com/postgresql-error-canceling-statement-due-to-conflict-with-recovery/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=postgresql-error-canceling-statement-due-to-conflict-with-recovery</link>
					<comments>https://sqlconjuror.com/postgresql-error-canceling-statement-due-to-conflict-with-recovery/#respond</comments>
		
		<dc:creator><![CDATA[Enrique]]></dc:creator>
		<pubDate>Tue, 21 Nov 2023 08:32:13 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[Troubleshooting]]></category>
		<guid isPermaLink="false">https://sqlconjuror.com/?p=3448</guid>

					<description><![CDATA[<p>Sample Log Output: Description: When the standby server receives updates/deletes in the WAL stream that will result in invalidating data currently being accessed by a running query, this error will happen. <a class="continue-reading-link" href="https://sqlconjuror.com/postgresql-error-canceling-statement-due-to-conflict-with-recovery/"> Continue reading</a></p>
<p>The post <a href="https://sqlconjuror.com/postgresql-error-canceling-statement-due-to-conflict-with-recovery/">PostgreSQL – Error: Canceling statement due to conflict with recovery</a> first appeared on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
<p>The post <a href="https://sqlconjuror.com/postgresql-error-canceling-statement-due-to-conflict-with-recovery/">PostgreSQL &#8211; Error: Canceling statement due to conflict with recovery</a> appeared first on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p class="wp-block-paragraph"><strong>Sample Log Output:</strong></p>



<figure class="wp-block-image size-full"><img data-recalc-dims="1" decoding="async" width="804" height="94" src="https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/11/image.png?resize=804%2C94&#038;ssl=1" alt="" class="wp-image-3449" srcset="https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/11/image.png?w=804&amp;ssl=1 804w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/11/image.png?resize=300%2C35&amp;ssl=1 300w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/11/image.png?resize=768%2C90&amp;ssl=1 768w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/11/image.png?resize=150%2C18&amp;ssl=1 150w" sizes="(max-width: 804px) 100vw, 804px" /></figure>



<p class="wp-block-paragraph"><strong>Description:</strong></p>



<p class="wp-block-paragraph">When the standby server receives updates/deletes in the WAL stream that will result in invalidating data currently being accessed by a running query, this error will happen. <span><a onclick="read_toggle(954998289, 'Read More', 'Read Less'); return false;" class="read-link" id="readlink954998289" style="readlink" href="#">Read More</a></span>
<div class="read_div" id="read954998289" style="display: none;"></p>



<p class="wp-block-paragraph"><strong>Suggested Solutions:</strong></p>



<ol class="wp-block-list">
<li>Set&nbsp;<strong>hot_standby_feedback = on</strong> on the standby. This will pass a message to the Primary server that some rows are still required in a table. It will allow queries on the Secondary replica to be completed, but it will cause bloat in the Primary.</li>



<li>Increase <strong>max_standby_archive_delay&nbsp;/&nbsp;max_standby_streaming_delay</strong>. This will allow the queries to finish as well by allowing the standby server to purposely augment replication lag.</li>
</ol>



<p class="wp-block-paragraph">Otherwise, since you can also try to resubmit the queries, you may be okay with those queries being canceled sometimes. </p>



<p class="wp-block-paragraph">Cheers! </div></p>The post <a href="https://sqlconjuror.com/postgresql-error-canceling-statement-due-to-conflict-with-recovery/">PostgreSQL – Error: Canceling statement due to conflict with recovery</a> first appeared on <a href="https://sqlconjuror.com">SQL Conjuror</a>.<p>The post <a href="https://sqlconjuror.com/postgresql-error-canceling-statement-due-to-conflict-with-recovery/">PostgreSQL &#8211; Error: Canceling statement due to conflict with recovery</a> appeared first on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlconjuror.com/postgresql-error-canceling-statement-due-to-conflict-with-recovery/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3448</post-id>	</item>
		<item>
		<title>PostgreSQL &#8211; Monitoring Replication</title>
		<link>https://sqlconjuror.com/postgresql-monitoring-replication/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=postgresql-monitoring-replication</link>
					<comments>https://sqlconjuror.com/postgresql-monitoring-replication/#respond</comments>
		
		<dc:creator><![CDATA[Enrique]]></dc:creator>
		<pubDate>Thu, 21 Sep 2023 07:07:44 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[High Availability / Disaster Recovery]]></category>
		<guid isPermaLink="false">https://sqlconjuror.com/?p=3425</guid>

					<description><![CDATA[<p>What is replication lag? How can we monitor Replication lag? Replication lag does not occur in most setups; however, it is important to monitor the entire endpoints of replication to ensure that our data is safe. What is Replication Lag? <a class="continue-reading-link" href="https://sqlconjuror.com/postgresql-monitoring-replication/"> Continue reading</a></p>
<p>The post <a href="https://sqlconjuror.com/postgresql-monitoring-replication/">PostgreSQL – Monitoring Replication</a> first appeared on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
<p>The post <a href="https://sqlconjuror.com/postgresql-monitoring-replication/">PostgreSQL &#8211; Monitoring Replication</a> appeared first on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p class="wp-block-paragraph">What is replication lag? How can we monitor Replication lag? Replication lag does not occur in most setups; however, it is important to monitor the entire endpoints of replication to ensure that our data is safe.</p>



<p class="wp-block-paragraph"><strong>What is Replication Lag?</strong> <span><a onclick="read_toggle(667831733, 'Read More', 'Read Less'); return false;" class="read-link" id="readlink667831733" style="readlink" href="#">Read More</a></span>
<div class="read_div" id="read667831733" style="display: none;"></p>



<p class="wp-block-paragraph">The data can be replicated from the primary/master node to the replica/slave node after the transaction has been committed on the primary node. The replica is never ahead of the primary. It is usually a little behind. This delay is called lag.</p>



<p class="wp-block-paragraph"><strong>Monitoring Primary Server</strong></p>



<p class="wp-block-paragraph">The system view to monitor Replication on the Primary node is <strong>pg_stat_replication</strong>.</p>



<pre style="font-family: consolas; font-size: 16px;">\d pg_stat_replication
                    View "pg_catalog.pg_stat_replication"
      Column      |           Type           | Collation | Nullable | Default 
------------------+--------------------------+-----------+----------+---------
 pid              | integer                  |           |          | 
 usesysid         | oid                      |           |          | 
 usename          | name                     |           |          | 
 application_name | text                     |           |          | 
 client_addr      | inet                     |           |          | 
 client_hostname  | text                     |           |          | 
 client_port      | integer                  |           |          | 
 backend_start    | timestamp with time zone |           |          | 
 backend_xmin     | xid                      |           |          | 
 state            | text                     |           |          | 
 sent_lsn         | pg_lsn                   |           |          | 
 write_lsn        | pg_lsn                   |           |          | 
 flush_lsn        | pg_lsn                   |           |          | 
 replay_lsn       | pg_lsn                   |           |          | 
 write_lag        | interval                 |           |          | 
 flush_lag        | interval                 |           |          | 
 replay_lag       | interval                 |           |          | 
 sync_priority    | integer                  |           |          | 
 sync_state       | text                     |           |          | 
 reply_time       | timestamp with time zone |           |          |
</pre>



<p class="wp-block-paragraph"><strong>Important Fields in pg_stat_replication</strong></p>



<p class="wp-block-paragraph">Let’s talk about the fields in detail.</p>



<ul class="wp-block-list">
<li><strong>pid: </strong>This represents the process ID of the wal_receiver process in charge of this streaming connection. If you check the process table in your operating system, you should find a PostgreSQL process with exactly this number</li>



<li><strong>usesysid</strong>: OID of user which is used for Streaming replication.</li>



<li><strong>usename:</strong> This (not username; mind the missing &#8220;r&#8221;) stores the name of the user related to usesysid. It is what the client has put into the connection string</li>



<li><strong>application_name</strong>: Application name connected to master</li>



<li><strong>client_addr:</strong> This will tell you where the streaming connection comes from. It holds the IP address of the client.</li>



<li><strong>client_hostname:</strong> Hostname of standby.</li>



<li><strong>client_port:</strong> This is the TCP port number the client is using for communication with the particular WAL sender. -1 will be shown if local UNIX sockets are used.</li>



<li><strong>backend_start: </strong>Start time when SR connected to Master.</li>



<li><strong>backend_xmin: </strong>The transaction ID reported by hot_standby_feedback (which is the oldest transaction ID on a slave). It can make sense to monitor the difference between the current transaction ID on the master and the oldest one reported by the slave as well, to check whether there are unusually high differences</li>



<li><strong>state:</strong> Current WAL sender state i.e streaming</li>



<li><strong>sent_lsn:</strong> This represents the last transaction log position sent to the connection.</li>



<li><strong>write_lsn:</strong> Last transaction written on disk at standby.</li>



<li><strong>flush_lsn:</strong> This is the last location that was flushed to the standby system. Mind the difference between writing and flushing here. Writing does not imply flushing.</li>



<li><strong>replay_lsn:</strong> Last transaction flush on disk at standby.</li>



<li><strong>write_lag:</strong> Elapsed time during committed WALs from primary to the standby (but not yet committed in the standby)</li>



<li><strong>flush_lag:</strong> Elapsed time during committed WALs from primary to the standby (WAL’s has already been flushed but not yet applied)</li>



<li><strong>replay_lag:</strong> Elapsed time during committed WALs from primary to the standby (fully committed in standby node)</li>



<li><strong>sync_priority: </strong>Priority of standby server being chosen as synchronous standby</li>



<li><strong>sync_state:</strong> Sync State of standby (is it async or synchronous).</li>
</ul>



<p class="wp-block-paragraph"><strong>Below is &nbsp;a sample query output with a single replica:</strong></p>



<figure class="wp-block-image size-full"><img data-recalc-dims="1" decoding="async" width="835" height="295" src="https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/09/image-1.png?resize=835%2C295&#038;ssl=1" alt="" class="wp-image-3429" srcset="https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/09/image-1.png?w=835&amp;ssl=1 835w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/09/image-1.png?resize=300%2C106&amp;ssl=1 300w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/09/image-1.png?resize=768%2C271&amp;ssl=1 768w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/09/image-1.png?resize=150%2C53&amp;ssl=1 150w" sizes="(max-width: 835px) 100vw, 835px" /></figure>



<p class="wp-block-paragraph"></p>



<figure class="wp-block-image size-full"><img data-recalc-dims="1" loading="lazy" decoding="async" width="432" height="375" src="https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/09/image.png?resize=432%2C375&#038;ssl=1" alt="" class="wp-image-3428" srcset="https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/09/image.png?w=432&amp;ssl=1 432w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/09/image.png?resize=300%2C260&amp;ssl=1 300w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/09/image.png?resize=403%2C350&amp;ssl=1 403w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/09/image.png?resize=150%2C130&amp;ssl=1 150w" sizes="auto, (max-width: 432px) 100vw, 432px" /></figure>



<p class="wp-block-paragraph"></p>



<p class="wp-block-paragraph">When you see an entry in the system view, that means that there is one ACTIVE stream. Otherwise, there is none. You won’t see any entry.</p>



<p class="wp-block-paragraph">If the values of all *_lsn columns are the same, that means that the Replica has caught up 100%.</p>



<figure class="wp-block-image size-full"><img data-recalc-dims="1" loading="lazy" decoding="async" width="660" height="103" src="https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/09/image-2.png?resize=660%2C103&#038;ssl=1" alt="" class="wp-image-3430" srcset="https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/09/image-2.png?w=660&amp;ssl=1 660w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/09/image-2.png?resize=300%2C47&amp;ssl=1 300w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/09/image-2.png?resize=150%2C23&amp;ssl=1 150w" sizes="auto, (max-width: 660px) 100vw, 660px" /></figure>



<p class="wp-block-paragraph"><strong>sent_lsn:</strong> Last write-ahead log location sent on this connection (How much WAL has been sent over the network already?).</p>



<p class="wp-block-paragraph"><strong>write_lsn:</strong> Last write-ahead log location written to the operating system (without flushing). </p>



<p class="wp-block-paragraph"><strong>flush_lsn:</strong> Last write-ahead log location flushed to disk by this standby server.</p>



<p class="wp-block-paragraph"><strong>replay_lsn:</strong> Last write-ahead log location replayed into the database on this standby server (Data that is already visible to end-users).</p>



<p class="wp-block-paragraph"><strong>The following is an illustration of the data flow.</strong></p>



<figure class="wp-block-image size-full is-resized"><img data-recalc-dims="1" loading="lazy" decoding="async" width="920" height="531" src="https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/09/image-3.png?resize=920%2C531&#038;ssl=1" alt="" class="wp-image-3433" style="width:839px;height:484px" srcset="https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/09/image-3.png?w=964&amp;ssl=1 964w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/09/image-3.png?resize=300%2C173&amp;ssl=1 300w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/09/image-3.png?resize=768%2C443&amp;ssl=1 768w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/09/image-3.png?resize=607%2C350&amp;ssl=1 607w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/09/image-3.png?resize=150%2C87&amp;ssl=1 150w" sizes="auto, (max-width: 920px) 100vw, 920px" /></figure>



<p class="wp-block-paragraph"><strong>Monitoring Replica Servers</strong></p>



<p class="wp-block-paragraph">Replica server has incoming replication and remains in recovery mode so that it can replay the WALs/records as they come in. There is a view called <strong>pg_stat_wal_receiver</strong>.</p>



<figure class="wp-block-image size-full is-resized"><img data-recalc-dims="1" loading="lazy" decoding="async" width="625" height="325" src="https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/09/image-4.png?resize=625%2C325&#038;ssl=1" alt="" class="wp-image-3434" style="width:625px;height:325px" srcset="https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/09/image-4.png?w=625&amp;ssl=1 625w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/09/image-4.png?resize=300%2C156&amp;ssl=1 300w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/09/image-4.png?resize=150%2C78&amp;ssl=1 150w" sizes="auto, (max-width: 625px) 100vw, 625px" /></figure>



<pre style="font-family: consolas; font-size: 16px;">\d pg_stat_wal_receiver
                      View "pg_catalog.pg_stat_wal_receiver"
        Column         |           Type           | Collation | Nullable | Default 
-----------------------+--------------------------+-----------+----------+---------
 pid                   | integer                  |           |          | 
 status                | text                     |           |          | 
 receive_start_lsn     | pg_lsn                   |           |          | 
 receive_start_tli     | integer                  |           |          | 
 written_lsn           | pg_lsn                   |           |          | 
 flushed_lsn           | pg_lsn                   |           |          | 
 received_tli          | integer                  |           |          | 
 last_msg_send_time    | timestamp with time zone |           |          | 
 last_msg_receipt_time | timestamp with time zone |           |          | 
 latest_end_lsn        | pg_lsn                   |           |          | 
 latest_end_time       | timestamp with time zone |           |          | 
 slot_name             | text                     |           |          | 
 sender_host           | text                     |           |          | 
 sender_port           | integer                  |           |          | 
 conninfo              | text                     |           |          |
</pre>



<p class="wp-block-paragraph"><strong>Monitoring Replication Slots</strong></p>



<p class="wp-block-paragraph">The view <strong>pg_replication_slots</strong> gives one row for each replication slot in the primary. A replication slot guarantees that the &nbsp;WAL will not vanish if the replica is lagging behind. A primary will recycle its WAL as soon as it doesn’t need it on its own anymore if there are no replication slots.</p>



<pre style="font-family: consolas; font-size: 16px;">\d pg_replication_slots
             View "pg_catalog.pg_replication_slots"
       Column        |  Type   | Collation | Nullable | Default 
---------------------+---------+-----------+----------+---------
 slot_name           | name    |           |          | 
 plugin              | name    |           |          | 
 slot_type           | text    |           |          | 
 datoid              | oid     |           |          | 
 database            | name    |           |          | 
 temporary           | boolean |           |          | 
 active              | boolean |           |          | 
 active_pid          | integer |           |          | 
 xmin                | xid     |           |          | 
 catalog_xmin        | xid     |           |          | 
 restart_lsn         | pg_lsn  |           |          | 
 confirmed_flush_lsn | pg_lsn  |           |          | 
 wal_status          | text    |           |          | 
 safe_wal_size       | bigint  |           |          | 
 two_phase           | boolean |           |          |
</pre>



<p class="wp-block-paragraph">Cheers! </div></p>The post <a href="https://sqlconjuror.com/postgresql-monitoring-replication/">PostgreSQL – Monitoring Replication</a> first appeared on <a href="https://sqlconjuror.com">SQL Conjuror</a>.<p>The post <a href="https://sqlconjuror.com/postgresql-monitoring-replication/">PostgreSQL &#8211; Monitoring Replication</a> appeared first on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlconjuror.com/postgresql-monitoring-replication/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3425</post-id>	</item>
		<item>
		<title>PostgreSQL &#8211; Health Check Scripts</title>
		<link>https://sqlconjuror.com/postgresql-health-check-scripts/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=postgresql-health-check-scripts</link>
					<comments>https://sqlconjuror.com/postgresql-health-check-scripts/#respond</comments>
		
		<dc:creator><![CDATA[Enrique]]></dc:creator>
		<pubDate>Thu, 03 Aug 2023 10:25:22 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Database Administration]]></category>
		<guid isPermaLink="false">https://sqlconjuror.com/?p=3410</guid>

					<description><![CDATA[<p>Here are some scripts that you can use to check the health of your PostgreSQL DB servers. Check Uptime SELECT current_timestamp - pg_postmaster_start_time(); Monitor cache hit ratio Tells how often your data is served from memory vs having to go to disk. 99% is a good metric for performance. <a class="continue-reading-link" href="https://sqlconjuror.com/postgresql-health-check-scripts/"> Continue reading</a></p>
<p>The post <a href="https://sqlconjuror.com/postgresql-health-check-scripts/">PostgreSQL – Health Check Scripts</a> first appeared on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
<p>The post <a href="https://sqlconjuror.com/postgresql-health-check-scripts/">PostgreSQL &#8211; Health Check Scripts</a> appeared first on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p class="wp-block-paragraph">Here are some scripts that you can use to check the health of your PostgreSQL DB servers. </p>



<p style="color:#BF4D28; font-size:20px;"><b>Check Uptime</b></p>



<pre style="font-family: consolas; font-size: 16px;">SELECT current_timestamp - pg_postmaster_start_time();
</pre>



<p style="color:#BF4D28; font-size:20px;"><b>Monitor cache hit ratio</b></p>



<p class="wp-block-paragraph">Tells how often your data is served from memory vs having to go to disk. 99% is a good metric for performance. <span><a onclick="read_toggle(1454419793, 'Read More', 'Read Less'); return false;" class="read-link" id="readlink1454419793" style="readlink" href="#">Read More</a></span>
<div class="read_div" id="read1454419793" style="display: none;"></p>



<pre style="font-family: consolas; font-size: 16px;">SELECT
  sum(heap_blks_read) as heap_read,
  sum(heap_blks_hit)  as heap_hit,
  sum(heap_blks_hit) / (sum(heap_blks_hit) + sum(heap_blks_read)) as ratio
FROM
  pg_statio_user_tables;
</pre>



<pre style="font-family: consolas; font-size: 16px;">SELECT 
  datname, 
  (
    blks_hit * 100 /(blks_hit + blks_read)
  ):: numeric as hit_ratio 
from 
  pg_stat_database WHERE 
  datname not in (
    'postgres', 'template0', 'template1'
  );
</pre>



<p class="wp-block-paragraph">If the hit ratio is less than 90%, there may be a problem with low allocation of shared buffers or queries doing large table scans. The hit ratio should be close to 100%. Boost shared buffers or tweak queries that do more IO.</p>



<p style="color:#BF4D28; font-size:20px;"><b>Check unvacummed dead tupes – Get table bloat information</b></p>



<p class="wp-block-paragraph">Bloat can slow down other write and creates other issues.</p>



<p class="wp-block-paragraph"><strong>1st script:</strong></p>



<pre style="font-family: consolas; font-size: 16px;">WITH constants AS (
  SELECT current_setting('block_size')::numeric AS bs, 23 AS hdr, 4 AS ma
), bloat_info AS (
  SELECT
    ma,bs,schemaname,tablename,
    (datawidth+(hdr+ma-(case when hdr%ma=0 THEN ma ELSE hdr%ma END)))::numeric AS datahdr,
    (maxfracsum*(nullhdr+ma-(case when nullhdr%ma=0 THEN ma ELSE nullhdr%ma END))) AS nullhdr2
  FROM (
    SELECT
      schemaname, tablename, hdr, ma, bs,
      SUM((1-null_frac)*avg_width) AS datawidth,
      MAX(null_frac) AS maxfracsum,
      hdr+(
        SELECT 1+count(*)/8
        FROM pg_stats s2
        WHERE null_frac<>0 AND s2.schemaname = s.schemaname AND s2.tablename = s.tablename
      ) AS nullhdr
    FROM pg_stats s, constants
    GROUP BY 1,2,3,4,5
  ) AS foo
), table_bloat AS (
  SELECT
    schemaname, tablename, cc.relpages, bs,
    CEIL((cc.reltuples*((datahdr+ma-
      (CASE WHEN datahdr%ma=0 THEN ma ELSE datahdr%ma END))+nullhdr2+4))/(bs-20::float)) AS otta
  FROM bloat_info
  JOIN pg_class cc ON cc.relname = bloat_info.tablename
  JOIN pg_namespace nn ON cc.relnamespace = nn.oid AND nn.nspname = bloat_info.schemaname AND nn.nspname <> 'information_schema'
), index_bloat AS (
  SELECT
    schemaname, tablename, bs,
    COALESCE(c2.relname,'?') AS iname, COALESCE(c2.reltuples,0) AS ituples, COALESCE(c2.relpages,0) AS ipages,
    COALESCE(CEIL((c2.reltuples*(datahdr-12))/(bs-20::float)),0) AS iotta -- very rough approximation, assumes all cols
  FROM bloat_info
  JOIN pg_class cc ON cc.relname = bloat_info.tablename
  JOIN pg_namespace nn ON cc.relnamespace = nn.oid AND nn.nspname = bloat_info.schemaname AND nn.nspname <> 'information_schema'
  JOIN pg_index i ON indrelid = cc.oid
  JOIN pg_class c2 ON c2.oid = i.indexrelid
)
SELECT
  type, schemaname, object_name, bloat, pg_size_pretty(raw_waste) as waste
FROM
(SELECT
  'table' as type,
  schemaname,
  tablename as object_name,
  ROUND(CASE WHEN otta=0 THEN 0.0 ELSE table_bloat.relpages/otta::numeric END,1) AS bloat,
  CASE WHEN relpages < otta THEN '0' ELSE (bs*(table_bloat.relpages-otta)::bigint)::bigint END AS raw_waste
FROM
  table_bloat
    UNION
SELECT
  'index' as type,
  schemaname,
  tablename || '::' || iname as object_name,
  ROUND(CASE WHEN iotta=0 OR ipages=0 THEN 0.0 ELSE ipages/iotta::numeric END,1) AS bloat,
  CASE WHEN ipages < iotta THEN '0' ELSE (bs*(ipages-iotta))::bigint END AS raw_waste
FROM
  index_bloat) bloat_summary
ORDER BY raw_waste DESC, bloat DESC;
</pre>



<p class="wp-block-paragraph"><strong>2nd Script</strong>:</p>



<pre style="font-family: consolas; font-size: 16px;">WITH constants AS 
(
       -- define some constants for sizes of things
       -- for reference down the query and easy maintenance
       
   SELECT
      current_setting('block_size')::numeric AS bs,
      23 AS hdr,
      8 AS ma 
)
,
no_stats AS 
(
       -- screen out table who have attributes
       -- which dont have stats, such as JSON
       
   SELECT
      table_schema,
      table_name,
              n_live_tup::numeric as est_rows,
              pg_table_size(relid)::numeric as table_size     
   FROM
      information_schema.columns         
      JOIN
         pg_stat_user_tables as psut            
         ON table_schema = psut.schemaname            
         AND table_name = psut.relname         
      LEFT OUTER JOIN
         pg_stats         
         ON table_schema = pg_stats.schemaname             
         AND table_name = pg_stats.tablename             
         AND column_name = attname     
   WHERE
      attname IS NULL         
      AND table_schema NOT IN 
      (
         'pg_catalog',
         'information_schema'
      )
          
   GROUP BY
      table_schema,
      table_name,
      relid,
      n_live_tup 
)
,
null_headers AS 
(
       -- calculate null header sizes
       -- omitting tables which dont have complete stats
       -- and attributes which aren't visible
       
   SELECT
              hdr + 1 + (sum(
      case
         when
            null_frac <> 0 
         THEN
            1 
         else
            0 
      END
) / 8) as nullhdr,         SUM((1 - null_frac)*avg_width) as datawidth,         MAX(null_frac) as maxfracsum,         schemaname,         tablename,         hdr, ma, bs     
   FROM
      pg_stats 
      CROSS JOIN
         constants         
      LEFT OUTER JOIN
         no_stats             
         ON schemaname = no_stats.table_schema             
         AND tablename = no_stats.table_name     
   WHERE
      schemaname NOT IN 
      (
         'pg_catalog', 'information_schema'
      )
              
      AND no_stats.table_name IS NULL         
      AND EXISTS 
      (
         SELECT
            1             
         FROM
            information_schema.columns                 
         WHERE
            schemaname = columns.table_schema                     
            AND tablename = columns.table_name 
      )
          
   GROUP BY
      schemaname,
      tablename,
      hdr,
      ma,
      bs 
)
,
data_headers AS 
(
       -- estimate header and row size
       
   SELECT
              ma,
      bs,
      hdr,
      schemaname,
      tablename,
              (datawidth + (hdr + ma - (
      case
         when
            hdr % ma = 0 
         THEN
            ma 
         ELSE
            hdr % ma 
      END
)))::numeric AS datahdr,         (maxfracsum*(nullhdr + ma - (
      case
         when
            nullhdr % ma = 0 
         THEN
            ma 
         ELSE
            nullhdr % ma 
      END
))) AS nullhdr2     
   FROM
      null_headers 
)
, table_estimates AS 
(
       -- make estimates of how large the table should be
       -- based on row and page size
       
   SELECT
      schemaname,
      tablename,
      bs,
              reltuples::numeric as est_rows,
      relpages * bs as table_bytes,
          CEIL((reltuples*             (datahdr + nullhdr2 + 4 + ma -                 (
      CASE
         WHEN
            datahdr % ma = 0                     
         THEN
            ma 
         ELSE
            datahdr % ma 
      END
)                 ) / (bs - 20))) * bs AS expected_bytes,         reltoastrelid     
   FROM
      data_headers         
      JOIN
         pg_class 
         ON tablename = relname         
      JOIN
         pg_namespace 
         ON relnamespace = pg_namespace.oid             
         AND schemaname = nspname     
   WHERE
      pg_class.relkind = 'r' 
)
, estimates_with_toast AS 
(
       -- add in estimated TOAST table sizes
       -- estimate based on 4 toast tuples per page because we dont have
       -- anything better.  also append the no_data tables
       
   SELECT
      schemaname,
      tablename,
              TRUE as can_estimate,
              est_rows,
              table_bytes + ( coalesce(toast.relpages, 0) * bs ) as table_bytes,
              expected_bytes + ( ceil( coalesce(toast.reltuples, 0) / 4 ) * bs ) as expected_bytes     
   FROM
      table_estimates 
      LEFT OUTER JOIN
         pg_class as toast         
         ON table_estimates.reltoastrelid = toast.oid             
         AND toast.relkind = 't' 
)
,
table_estimates_plus AS 
(
   -- add some extra metadata to the table data
   -- and calculations to be reused
   -- including whether we cant estimate it
   -- or whether we think it might be compressed
       
   SELECT
      current_database() as databasename,
                  schemaname,
      tablename,
      can_estimate,
                  est_rows,
                  
      CASE
         WHEN
            table_bytes > 0                 
         THEN
            table_bytes::NUMERIC                 
         ELSE
            NULL::NUMERIC 
      END
                      AS table_bytes,             
      CASE
         WHEN
            expected_bytes > 0                 
         THEN
            expected_bytes::NUMERIC                 
         ELSE
            NULL::NUMERIC 
      END
                          AS expected_bytes,             
      CASE
         WHEN
            expected_bytes > 0 
            AND table_bytes > 0                 
            AND expected_bytes <= table_bytes                 
         THEN
(table_bytes - expected_bytes)::NUMERIC                 
         ELSE
            0::NUMERIC 
      END
      AS bloat_bytes     
   FROM
      estimates_with_toast     
   UNION ALL
       
   SELECT
      current_database() as databasename,
              table_schema,
      table_name,
      FALSE,
              est_rows,
      table_size,
              NULL::NUMERIC,
      NULL::NUMERIC     FROM no_stats 
)
,
bloat_data AS 
(
       -- do final math calculations and formatting
       
   select
      current_database() as databasename,
              schemaname,
      tablename,
      can_estimate,
              table_bytes,
      round(table_bytes / (1024 ^ 2)::NUMERIC, 3) as table_mb,
              expected_bytes,
      round(expected_bytes / (1024 ^ 2)::NUMERIC, 3) as expected_mb,
              round(bloat_bytes*100 / table_bytes) as pct_bloat,
              round(bloat_bytes / (1024::NUMERIC ^ 2), 2) as mb_bloat,
              table_bytes,
      expected_bytes,
      est_rows     
   FROM
      table_estimates_plus 
)
-- filter output for bloated tables
SELECT
   databasename,
   schemaname,
   tablename,
       can_estimate,
       est_rows,
       pct_bloat,
   mb_bloat,
       table_mb 
FROM
   bloat_data -- this where clause defines which tables actually appear
   -- in the bloat chart
   -- example below filters for tables which are either 50%
   -- bloated and more than 20mb in size, or more than 25%
   -- bloated and more than 1GB in size
WHERE
   (
      pct_bloat >= 50 
      AND mb_bloat >= 20 
   )
       
   OR 
   (
      pct_bloat >= 25 
      AND mb_bloat >= 1000 
   )
ORDER BY
   pct_bloat DESC;
</pre>



<p style="color:#BF4D28; font-size:20px;"><b>Finding Unused Indexes</b></p>



<p class="wp-block-paragraph">The following query will return any unused indexes which are not part of any constraint.</p>



<pre style="font-family: consolas; font-size: 16px;">SELECT s.schemaname,
  s.relname AS tablename,
  s.indexrelname AS indexname,
  pg_relation_size(s.indexrelid) AS index_size
FROM pg_catalog.pg_stat_user_indexes s
  JOIN pg_catalog.pg_index i ON s.indexrelid = i.indexrelid
WHERE s.idx_scan = 0  
  AND 0 <>ALL (i.indkey)  
  AND NOT i.indisunique  
  AND NOT EXISTS  
  (SELECT 1 FROM pg_catalog.pg_constraint c
  WHERE c.conindid = s.indexrelid)
  AND NOT EXISTS  
  (SELECT 1 FROM pg_catalog.pg_inherits AS inh
  WHERE inh.inhrelid = s.indexrelid)
ORDER BY pg_relation_size(s.indexrelid) DESC;
</pre>



<p style="color:#BF4D28; font-size:20px;"><b>Check query performance</b></p>



<pre style="font-family: consolas; font-size: 16px;">SELECT query,
       calls,
       total_time,
       total_time / calls as time_per,
       stddev_time,
       rows,
       rows / calls as rows_per,
       100.0 * shared_blks_hit / nullif(shared_blks_hit + shared_blks_read, 0) AS hit_percent
FROM pg_stat_statements
WHERE query not similar to '%pg_%'
and calls > 500
--ORDER BY calls
--ORDER BY total_time
order by time_per
--ORDER BY rows_per
DESC LIMIT 20;
</pre>



<p style="color:#BF4D28; font-size:20px;"><b>Check commit ratio of database</b></p>



<p class="wp-block-paragraph">We must engage with the application team to determine why there are so many transaction rollbacks if the commit percentage is less than 95%. Consider a scenario where many of your transactions contain DML which can result in fragmentation.</p>



<pre style="font-family: consolas; font-size: 16px;">SELECT 
  datname, 
  round(
    (
      xact_commit :: float * 100 /(xact_commit + xact_rollback)
    ):: numeric, 
    2
  ) as successful_xact_ratio 
FROM 
  pg_stat_database 
WHERE 
  datname not in (
    'postgres', 'template0', 'template1'
  );
</pre>



<p style="color:#BF4D28; font-size:20px;"><b>Get the temp file usage of database</b></p>



<p class="wp-block-paragraph">Use the log_temp_files parameter to log queries utilizing the temp files and modify the queries if you see that the temp files and bytes are high.</p>



<pre style="font-family: consolas; font-size: 16px;">select 
  datname, 
  temp_files, 
  round(temp_bytes / 1024 / 1024, 2) as temp_filesize_MB 
from 
  pg_stat_database 
WHERE 
  datname not in (
    'postgres', 'template0', 'template1'
  ) 
  and temp_files > 0;


</pre>



<p style="color:#BF4D28; font-size:20px;"><b>Frequency of Checkpoints</b></p>



<p class="wp-block-paragraph">There are two important columns <strong>checkpoints_req</strong>, <strong>checkpoints_timed</strong>.</p>



<p class="wp-block-paragraph">If the checkpoints_req is more than the checkpoints_timed, PostgreSQL is doing checkpoints due to the high WAL generation.</p>



<p class="wp-block-paragraph">If the checkpoints are happening frequently it will cause more IO load on the machine so increase the max_wal_size parameter.</p>



<p class="wp-block-paragraph">checkpoints_req &gt; checkpoints_timed = (bad)PostgreSQL is doing checkpoints due to the high WAL generation.</p>



<p class="wp-block-paragraph">Use the below query to find the frequency of the checkpoints.</p>



<pre style="font-family: consolas; font-size: 16px;">Use below query to find the frequency of the checkpoints
WITH sub as (
  SELECT 
    EXTRACT(
      EPOCH 
      FROM 
        (now() - stats_reset)
    ) AS seconds_since_start, 
    (
      checkpoints_timed + checkpoints_req
    ) AS total_checkpoints 
  FROM 
    pg_stat_bgwriter
) 
SELECT 
  total_checkpoints, 
  seconds_since_start / total_checkpoints / 60 AS minutes_between_checkpoints 
FROM 
  sub;
</pre>



<p style="color:#BF4D28; font-size:20px;"><b>Get top five tables with highest sequential scans</b></p>



<pre style="font-family: consolas; font-size: 16px;">SELECT 
  schemaname, 
  relname, 
  seq_scan, 
  seq_tup_read, 
  seq_tup_read / seq_scan as avg_seq_tup_read 
FROM 
  pg_stat_all_tables 
WHERE 
  seq_scan > 0 
  and pg_total_relation_size(schemaname || '.' || relname) > 104857600 
  and schemaname IN ('"gameserver"')
ORDER BY 
  5 DESC 
LIMIT 
  20;

</pre>



<p class="wp-block-paragraph">Cheers! </div></p>The post <a href="https://sqlconjuror.com/postgresql-health-check-scripts/">PostgreSQL – Health Check Scripts</a> first appeared on <a href="https://sqlconjuror.com">SQL Conjuror</a>.<p>The post <a href="https://sqlconjuror.com/postgresql-health-check-scripts/">PostgreSQL &#8211; Health Check Scripts</a> appeared first on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlconjuror.com/postgresql-health-check-scripts/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3410</post-id>	</item>
		<item>
		<title>PostgreSQL &#8211; Using pgbench for Benchmark Testing</title>
		<link>https://sqlconjuror.com/postgresql-using-pgbench-for-benchmark-testing/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=postgresql-using-pgbench-for-benchmark-testing</link>
					<comments>https://sqlconjuror.com/postgresql-using-pgbench-for-benchmark-testing/#respond</comments>
		
		<dc:creator><![CDATA[Enrique]]></dc:creator>
		<pubDate>Mon, 31 Jul 2023 03:32:22 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[Performance Optimization]]></category>
		<guid isPermaLink="false">https://sqlconjuror.com/?p=3396</guid>

					<description><![CDATA[<p>pgbench is a tool for testing the performance of a PostgreSQL database. It works by simulating a specified number of concurrent clients who are executing a series of SQL commands. You can use pgbench to measure the performance of your database and to compare the performance of different database configurations. ... <a class="continue-reading-link" href="https://sqlconjuror.com/postgresql-using-pgbench-for-benchmark-testing/"> Continue reading</a></p>
<p>The post <a href="https://sqlconjuror.com/postgresql-using-pgbench-for-benchmark-testing/">PostgreSQL – Using pgbench for Benchmark Testing</a> first appeared on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
<p>The post <a href="https://sqlconjuror.com/postgresql-using-pgbench-for-benchmark-testing/">PostgreSQL &#8211; Using pgbench for Benchmark Testing</a> appeared first on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p class="wp-block-paragraph">pgbench is a tool for testing the performance of a PostgreSQL database. It works by simulating a specified number of concurrent clients who are executing a series of SQL commands. You can use pgbench to measure the performance of your database and to compare the performance of different database configurations. The pgbench approach is based on TPC-B . The TPC-B benchmark focuses on benchmarking as opposed to OLTP type testing. <span><a onclick="read_toggle(1878572816, 'Read More', 'Read Less'); return false;" class="read-link" id="readlink1878572816" style="readlink" href="#">Read More</a></span>
<div class="read_div" id="read1878572816" style="display: none;"></p>



<p class="wp-block-paragraph">The measurement is based on transactions per second.&nbsp; In other words &#8211; you&#8217;ll define how many transactions to execute per client and this will result in a rate per second.</p>



<p style="color:#BF4D28; font-size:20px;"><b>Using pgbench for Benchmark Testing</b></p>



<p class="wp-block-paragraph">1. Create a sample database</p>



<pre style="font-family: consolas; font-size: 16px;">CREATE DATABASE example;
</pre>



<p class="wp-block-paragraph">We now have an empty database named <strong>example</strong>. Let’s return to our bash shell to execute pgbench commands. We can do this by issuing the \q (quit) command.</p>



<p class="wp-block-paragraph">2. Initialize the pgbench DB. This will create the sample tables in the DB</p>



<pre style="font-family: consolas; font-size: 16px;">pgbench -h 10.190.30.209 -p 5432 -U jvalencia -i -s 50 example
</pre>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="920" height="182" src="https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/07/image-1024x203.png?resize=920%2C182&#038;ssl=1" alt="" class="wp-image-3399" srcset="https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/07/image.png?resize=1024%2C203&amp;ssl=1 1024w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/07/image.png?resize=300%2C59&amp;ssl=1 300w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/07/image.png?resize=768%2C152&amp;ssl=1 768w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/07/image.png?resize=900%2C178&amp;ssl=1 900w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/07/image.png?resize=150%2C30&amp;ssl=1 150w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/07/image.png?w=1125&amp;ssl=1 1125w" sizes="auto, (max-width: 920px) 100vw, 920px" /></figure>



<p class="wp-block-paragraph">In the command above, we ran pgbench with the <strong>-i</strong> option and the <strong>-s</strong> option followed by the database name (<strong>example</strong>).</p>



<p class="wp-block-paragraph">The <strong>-i</strong> (initialize) option will tell pgbench to initialize the database specified. This will create the following tables within the example database.</p>



<figure class="wp-block-image size-full"><img data-recalc-dims="1" loading="lazy" decoding="async" width="458" height="191" src="https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/07/image-1.png?resize=458%2C191&#038;ssl=1" alt="" class="wp-image-3400" srcset="https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/07/image-1.png?w=458&amp;ssl=1 458w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/07/image-1.png?resize=300%2C125&amp;ssl=1 300w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/07/image-1.png?resize=150%2C63&amp;ssl=1 150w" sizes="auto, (max-width: 458px) 100vw, 458px" /></figure>



<p class="wp-block-paragraph">The <strong>-s</strong> is the scaling option.&nbsp; It is used to multiply the number of rows entered into each table. It will take the default rows and multiply it by 50 or whatever scaling number you entered.</p>



<p class="wp-block-paragraph">3. Establish a baseline.</p>



<pre style="font-family: consolas; font-size: 16px;">pgbench -h 10.190.30.209 -p 5432 -U jvalencia -c 10 -j 2 -t 10000 example
</pre>



<p class="wp-block-paragraph"><strong>-c</strong> number of clients</p>



<p class="wp-block-paragraph"><strong>-j</strong> number of threads</p>



<p class="wp-block-paragraph"><strong>-t</strong> amount of transactions </p>



<p class="wp-block-paragraph">These values are 10000 transactions per client (10 x 10000 = 100,000 transactions).</p>



<p class="wp-block-paragraph">3. Get results</p>



<p class="wp-block-paragraph">Below is a sample result set.</p>



<figure class="wp-block-image size-large"><img data-recalc-dims="1" loading="lazy" decoding="async" width="920" height="274" src="https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/07/image-2-1024x305.png?resize=920%2C274&#038;ssl=1" alt="" class="wp-image-3401" srcset="https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/07/image-2.png?resize=1024%2C305&amp;ssl=1 1024w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/07/image-2.png?resize=300%2C89&amp;ssl=1 300w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/07/image-2.png?resize=768%2C228&amp;ssl=1 768w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/07/image-2.png?resize=900%2C268&amp;ssl=1 900w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/07/image-2.png?resize=150%2C45&amp;ssl=1 150w, https://i0.wp.com/sqlconjuror.com/wp-content/uploads/2023/07/image-2.png?w=1103&amp;ssl=1 1103w" sizes="auto, (max-width: 920px) 100vw, 920px" /></figure>



<p class="wp-block-paragraph">The part of the output that we are most interested in is the following:</p>



<p class="wp-block-paragraph">tps = 2077.939220 (without initial connection time)</p>



<p class="wp-block-paragraph">This indicates that our baseline is 2077 database transactions per second.</p>



<p class="wp-block-paragraph">Cheers! </div></p>The post <a href="https://sqlconjuror.com/postgresql-using-pgbench-for-benchmark-testing/">PostgreSQL – Using pgbench for Benchmark Testing</a> first appeared on <a href="https://sqlconjuror.com">SQL Conjuror</a>.<p>The post <a href="https://sqlconjuror.com/postgresql-using-pgbench-for-benchmark-testing/">PostgreSQL &#8211; Using pgbench for Benchmark Testing</a> appeared first on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlconjuror.com/postgresql-using-pgbench-for-benchmark-testing/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3396</post-id>	</item>
		<item>
		<title>PostgreSQL &#8211; Analyzing Queries Using pg_stat_statements</title>
		<link>https://sqlconjuror.com/postgresql-analyzing-queries-using-pg_stat_statements/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=postgresql-analyzing-queries-using-pg_stat_statements</link>
					<comments>https://sqlconjuror.com/postgresql-analyzing-queries-using-pg_stat_statements/#respond</comments>
		
		<dc:creator><![CDATA[Enrique]]></dc:creator>
		<pubDate>Wed, 19 Jul 2023 10:18:33 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Database Administration]]></category>
		<category><![CDATA[Performance Optimization]]></category>
		<guid isPermaLink="false">https://sqlconjuror.com/?p=3390</guid>

					<description><![CDATA[<p>pg_stat_statements tracks planning and execution statistics of all SQL statements executed by a server. Find the top 10 time-consuming queries SELECT round( ( 100 * total_exec_time / sum(total_exec_time) OVER () ):: numeric, 2 ) percent, round(total_exec_time :: numeric, 2) AS total, calls, round(mean_exec_time :: numeric, 2) AS mean, substring(query, 1, ... <a class="continue-reading-link" href="https://sqlconjuror.com/postgresql-analyzing-queries-using-pg_stat_statements/"> Continue reading</a></p>
<p>The post <a href="https://sqlconjuror.com/postgresql-analyzing-queries-using-pg_stat_statements/">PostgreSQL – Analyzing Queries Using pg_stat_statements</a> first appeared on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
<p>The post <a href="https://sqlconjuror.com/postgresql-analyzing-queries-using-pg_stat_statements/">PostgreSQL &#8211; Analyzing Queries Using pg_stat_statements</a> appeared first on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p class="wp-block-paragraph">pg_stat_statements tracks planning and execution statistics of all SQL statements executed by a server. </p>



<p class="wp-block-paragraph"><strong>Find the top 10 time-consuming queries</strong></p>



<pre style="font-family: consolas; font-size: 16px;">SELECT 
  round(
    (
      100 * total_exec_time / sum(total_exec_time) OVER ()
    ):: numeric, 
    2
  ) percent, 
  round(total_exec_time :: numeric, 2) AS total, 
  calls, 
  round(mean_exec_time :: numeric, 2) AS mean, 
  substring(query, 1, 200) 
FROM 
  pg_stat_statements 
ORDER BY 
  total_exec_time DESC 
LIMIT 
  10;
</pre>



<p class="wp-block-paragraph"><strong>Find the queries that are writing to the temp the most</strong> <span><a onclick="read_toggle(88614785, 'Read More', 'Read Less'); return false;" class="read-link" id="readlink88614785" style="readlink" href="#">Read More</a></span>
<div class="read_div" id="read88614785" style="display: none;"></p>



<pre style="font-family: consolas; font-size: 16px;">select queryid, left(query,40), calls, temp_blks_read,
temp_blks_written from pg_stat_statements order by
temp_blks_written desc;
</pre>



<p class="wp-block-paragraph"><strong>Find the queries that are reading from temp the most</strong></p>



<pre style="font-family: consolas; font-size: 16px;">select queryid, left(query,40), calls, temp_blks_read,
temp_blks_written from pg_stat_statements order by temp_blks_read
desc;
</pre>



<p class="wp-block-paragraph"><strong>Find the queries that are reading from disk the most</strong></p>



<pre style="font-family: consolas; font-size: 16px;">select queryid, left(query,40), calls, local_blks_read,
local_blks_read/calls as avg_read_per_call from pg_stat_statements
order by local_blks_read desc;
</pre>



<p class="wp-block-paragraph"><strong>Find the queries with the highest execution times</strong></p>



<pre style="font-family: consolas; font-size: 16px;">select queryid, left(query,40), mean_exec_time, max_exec_time from
pg_stat_statements where calls > 10 order by mean_exec_time desc,
max_exec_time desc;
</pre>



<p class="wp-block-paragraph">Cheers! </div></p>



<p class="wp-block-paragraph"></p>The post <a href="https://sqlconjuror.com/postgresql-analyzing-queries-using-pg_stat_statements/">PostgreSQL – Analyzing Queries Using pg_stat_statements</a> first appeared on <a href="https://sqlconjuror.com">SQL Conjuror</a>.<p>The post <a href="https://sqlconjuror.com/postgresql-analyzing-queries-using-pg_stat_statements/">PostgreSQL &#8211; Analyzing Queries Using pg_stat_statements</a> appeared first on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlconjuror.com/postgresql-analyzing-queries-using-pg_stat_statements/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3390</post-id>	</item>
		<item>
		<title>PostgreSQL &#8211; Backing up and restoring one or more tables using pg_dump and pg_restore</title>
		<link>https://sqlconjuror.com/postgresql-backing-up-and-restoring-one-or-more-tables-using-pg_dump-and-pg_restore/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=postgresql-backing-up-and-restoring-one-or-more-tables-using-pg_dump-and-pg_restore</link>
					<comments>https://sqlconjuror.com/postgresql-backing-up-and-restoring-one-or-more-tables-using-pg_dump-and-pg_restore/#respond</comments>
		
		<dc:creator><![CDATA[Enrique]]></dc:creator>
		<pubDate>Wed, 05 Jul 2023 09:39:12 +0000</pubDate>
				<category><![CDATA[PostgreSQL]]></category>
		<category><![CDATA[Database Administration]]></category>
		<guid isPermaLink="false">https://sqlconjuror.com/?p=3364</guid>

					<description><![CDATA[<p>There are 2 types of backups in PostgreSQL: Logical backups in PostgreSQL can be taken using pg_dump. A backup taken using pg_dump can exist in both a text file (human-readable script file) format or a custom format. <a class="continue-reading-link" href="https://sqlconjuror.com/postgresql-backing-up-and-restoring-one-or-more-tables-using-pg_dump-and-pg_restore/"> Continue reading</a></p>
<p>The post <a href="https://sqlconjuror.com/postgresql-backing-up-and-restoring-one-or-more-tables-using-pg_dump-and-pg_restore/">PostgreSQL – Backing up and restoring one or more tables using pg_dump and pg_restore</a> first appeared on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
<p>The post <a href="https://sqlconjuror.com/postgresql-backing-up-and-restoring-one-or-more-tables-using-pg_dump-and-pg_restore/">PostgreSQL &#8211; Backing up and restoring one or more tables using pg_dump and pg_restore</a> appeared first on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p class="wp-block-paragraph"><strong>There are 2 types of backups</strong> <strong>in PostgreSQL:</strong></p>



<ol class="wp-block-list">
<li>Logical</li>



<li>Physical</li>
</ol>



<p class="wp-block-paragraph">Logical backups in PostgreSQL can be taken using <strong>pg_dump</strong>. A backup taken using pg_dump can exist in both a text file (human-readable script file) format or a custom format. <span><a onclick="read_toggle(1167611968, 'Read More', 'Read Less'); return false;" class="read-link" id="readlink1167611968" style="readlink" href="#">Read More</a></span>
<div class="read_div" id="read1167611968" style="display: none;"></p>



<p class="wp-block-paragraph">If you take a backup in plain format (.sql file), we can use&nbsp;<strong>psql&nbsp;</strong>to restore.</p>



<p class="wp-block-paragraph">If you take a backup in a custom format (tar/dir/binary), the only option to restore is&nbsp;<strong>pg_restore</strong>.</p>



<p class="wp-block-paragraph"><strong>pg_restore</strong>&nbsp;is 10x faster than psql.</p>



<p class="wp-block-paragraph">When you do a backup using pg_dump, it will not apply any locks; hence, it will not cause any waits to the database traffic.</p>



<p class="wp-block-paragraph"><strong>There are a few things to note before using pg_dump and planning your backup strategy:</strong></p>



<ul class="wp-block-list">
<li>Backing up multiple databases is not possible using pg_dump. It can only backup one database at a time.</li>



<li>pg_dump is not suitable for point-in-time recovery. To do a point-in-time recovery, WAL segments need to be replayed, but it will not be possible to replay transaction logs (WALs) after restoring backups taken using pg_dump.</li>



<li>To ensure that all the data from the disk is readable and have no corrupted pages, it is important to have a periodical logical backup testing.</li>
</ul>



<p class="wp-block-paragraph">Backing up a single or several tables from a database is possible using pg_dump. However, backing up a table from one database and another table from another database simultaneously is not possible. pg_dump can only work on one database at a time. Furthermore, taking a backup of an entire database excluding one or more tables is also possible.</p>



<p class="wp-block-paragraph">We shall use the flag <strong>-t</strong> to backup and restore a table.</p>



<p class="wp-block-paragraph"><strong>Syntax for backing up a table</strong>:</p>



<pre style="font-family: consolas; font-size: 16px;">pg_dump -h source_server -p source_port -U <username> database_name -Fformat -t tablename -f /location/dumpfile_name.bin
</pre>



<p class="wp-block-paragraph"><strong>Syntax to restore a custom format dump:</strong></p>



<pre style="font-family: consolas; font-size: 16px;">pg_restore -h target_server -p target_port -U username -d database_name -t tablename /backup_location/dumpfile_name.bin
</pre>



<p class="wp-block-paragraph"><strong>Syntax to restore a plain format dump:</strong></p>



<pre style="font-family: consolas; font-size: 16px;">psql -h target_server -p target_port -U username -d mypgdb -f /backup_dir/tables.sql
</pre>



<p style="color:#BF4D28; font-size:20px;"><b>Example: Backing up one or more tables</b></p>



<p class="wp-block-paragraph">1. In the example below, we are going to backup <strong>employees</strong> and <strong>salary</strong> tables.</p>



<p class="wp-block-paragraph"><strong>Custom format:</strong></p>



<pre style="font-family: consolas; font-size: 16px;">pg_dump -t employees -t salary -Fc -f /postgres/backups/employees_salary.bin -v
</pre>



<p class="wp-block-paragraph"><strong>Plain Format:</strong></p>



<pre style="font-family: consolas; font-size: 16px;">pg_dump -t employees -t salary -f /postgres/backups/employees_salary.sql -v
</pre>



<p class="wp-block-paragraph">2. If you want to restore these tables to another database in a target server, then create the database first. You may ignore this step if the database already exists.</p>



<pre style="font-family: consolas; font-size: 16px;">psql -c "CREATE DATABASE perf_review"
</pre>



<p class="wp-block-paragraph">3. Now, we are going to restore the two tables from backup to another database called perf_review:</p>



<p class="wp-block-paragraph"><strong>Custom format:</strong></p>



<pre style="font-family: consolas; font-size: 16px;">pg_restore -p5432 -U postgres -t employees -t salary -d perf_review /postgres/backups/employees_salary.bin -v
</pre>



<p class="wp-block-paragraph"><strong>Plain Format:</strong></p>



<pre style="font-family: consolas; font-size: 16px;">psql -p5432 -U postgres -t employees -t salary -d perf_review -f /postgres/backups/employees_salary.sql
</pre>



<p class="wp-block-paragraph">Cheers! </div></p>The post <a href="https://sqlconjuror.com/postgresql-backing-up-and-restoring-one-or-more-tables-using-pg_dump-and-pg_restore/">PostgreSQL – Backing up and restoring one or more tables using pg_dump and pg_restore</a> first appeared on <a href="https://sqlconjuror.com">SQL Conjuror</a>.<p>The post <a href="https://sqlconjuror.com/postgresql-backing-up-and-restoring-one-or-more-tables-using-pg_dump-and-pg_restore/">PostgreSQL &#8211; Backing up and restoring one or more tables using pg_dump and pg_restore</a> appeared first on <a href="https://sqlconjuror.com">SQL Conjuror</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://sqlconjuror.com/postgresql-backing-up-and-restoring-one-or-more-tables-using-pg_dump-and-pg_restore/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3364</post-id>	</item>
	</channel>
</rss>
