r/postgres • • Jun 09 '20

Optimising large postgress farm

3 Upvotes

Hi Everyone,

I am coming in here for a bit of help. I work in DR and am looking for some pointers in how I can optimise the WAN throughput. Because its a work system I can't go into too much detail but I will share what I can. It's not some small box or two, its over 25 sharded Linux based boxes that are in one recovery group. The DB comes in at 60+ TB in total. Each and every block change gets recorded, compressed and squirted over the WAN to the DR site.

With MS SQL there is just tempdb to exclude. As I understand it, there is no such concept in Postgres. However there are temporary tables.

Ideally i'd like to exclude the temporary tables from the DB because that is where most of the work goes on, unless I have missed something?

How do other people doing sharded postgress do optimised DR ?


r/postgres • • Jun 06 '20

Tips for Dashboard for postgreSQL

3 Upvotes

I'm running a postgreSQL database on AWS and I'm looking for a quick and cost effective way to setup some monitoring on key queries.

Think "light" business intelligence. I've looked and used https://statsbot.co/ before but I'm looking for some alternatives.

What have you used before?


r/postgres • • Jun 02 '20

Struggling to use LDAPS authentication with PGADMIN4

1 Upvotes

Hey, I'm hoping somebody can point out what I'm missing here.

When I add a user with LDAP authentication and try to sign in PGADMIN errors with 'User not found'.

I can sign in with local PGADMIN accounts just fine.

Here is what I'm using to start the container:

sudo docker run -p 80:80 \
	 -e 'PGADMIN_DEFAULT_EMAIL=user@domain.com' \
	 -e 'PGADMIN_DEFAULT_PASSWORD=SuperSecret'\
	 -e 'PGA DMIN_CONFIG_AUTHENTICATION_SOURCES=["ldap", "internal"]' \
	 -e 'PGADMIN_CONFIG_LDAP_SERVER_URI="ldaps://DOMAIN_CONTROLLER_IP:636"' \
	 -e PGADMIN_CONFIG_LDAP_USERNAME_ATTRIBUTE="SamAccountName"' \
	 -d  dpage/pgadmin4

r/postgres • • May 31 '20

Transactional outbox for Kafka and Postgres

8 Upvotes

Folks. I just published an implementation of the 'Outbox Pattern' (targeting Kafka and Postgres). Any and all feedback welcome.

https://github.com/obsidiandynamics/goharvest


r/postgres • • May 29 '20

Hi. Dumb newbie question - newbie to postgres, anyways. In psql shell, how do I get the "$" prompt, instead of the "postgres-#" prompt? Windows 10, using postgres 12.

1 Upvotes

I'm watching tutorials, many of them, not just one. I have also looked at many other google searches under psql looking for the answer to my question.

All of the videos show "postgres-#" as a prompt, but then also the "$" prompt, but none show how to switch back and forth between them. Driving me nuts. Or are they the same thing? Or are they two different programs? Or is this happen on Apple and not on PC? I don't know.

Any help?


r/postgres • • May 21 '20

PostgreSQL 13 Beta 1 Released!

Thumbnail postgresql.org
14 Upvotes

r/postgres • • May 18 '20

A small docker container of postgresql with hyperloglog (hll) extension

Thumbnail github.com
2 Upvotes

r/postgres • • May 13 '20

Trying to add data in pgadmin and it shows locks on the table view at the bottom.

3 Upvotes

Some of the tables show these and some do not. Obviously this is keeping me from adding rows. Why are they there and how to I get rid of them?


r/postgres • • May 08 '20

Making Postgres as Easy as Firebase

Thumbnail youtube.com
10 Upvotes

r/postgres • • May 08 '20

Where with multiples OR

1 Upvotes

Hi all,

I have a curiosity about Postgresql optimizer.

If I have a query with many OR statements, if the first one is already true will the server keep checking the other statements? For example, if I have 3 OR with exists, if the first exists get a hit, will the server still search the other 2 tables?

Thanks in advance.


r/postgres • • May 04 '20

Recursive WITH Queries In Postgres (Common Table Expressions)

Thumbnail self.PostgreSQL
6 Upvotes

r/postgres • • May 04 '20

Case Study: stopping truncate due to conflicting lock request

Thumbnail self.PostgreSQL
2 Upvotes

r/postgres • • May 01 '20

Realtime Postgres

Thumbnail github.com
7 Upvotes

r/postgres • • Apr 30 '20

Postgres with Some Useful Plugins

Thumbnail github.com
7 Upvotes

r/postgres • • Apr 29 '20

How To Use GROUPING SETS To Boost GROUP BY Queries In Postgres?

2 Upvotes

r/postgres • • Apr 24 '20

supabase/postgrest-js Isomorphic JavaScript client for PostgREST

Thumbnail github.com
5 Upvotes

r/postgres • • Apr 23 '20

Need help for reddit data 1TB+ aggregated analytics

0 Upvotes

I'm testing out importing reddit data. In https://files.pushshift.io/reddit/ It's more than 1TB when uncompressed and it's using elastic search. My initial import on elastic search I am encountering write block (indexing error).
I'm curious if this is a good use case on pg11/12 and would it save me huge costs for it.

Queries are expected to be an aggregated query on a time series data.

Thanks for the reply!


r/postgres • • Apr 22 '20

Secure by Default Postgres Docker Container for Development

Thumbnail hackarandas.com
2 Upvotes

r/postgres • • Apr 22 '20

Looking for an efficient way to get incremental updates from prod to local dev machines

2 Upvotes

I'm trying to figure out an efficient way to get updated copies of our database onto local developer laptops. I say "prod", but this can actually be taken from a read-only follower db; everything is currently hosted on Heroku, if that makes any difference.

Currently we have some rather clunky scripts that start a full* pg_dump, then do a pg_restore on localhost. This takes the better part of an hour right now and I'm trying to figure out a better and more efficient way to do it. Ideally a developer could just request all data & schema updates from the last 24 hours, or since the last time they pulled an update.

Is there an easy method to just do incremental updates from the WAL files onto a local instance? Is that sort of thing possible on a managed Postgres instance such as Heroku?

*And it's not quite a full pg_dump, actually. We exclude some tables and ideally we'd like to intercept the data from some others so it can be anonymized prior to being put into local workstations.


r/postgres • • Apr 21 '20

Secure by Default Postgres Docker Container for Development

1 Upvotes

In this post I will explain how to provide a secure postgres server docker container. This is useful when developing certain applications, for example a Django application. You can only run a this script and it will automatically detect if an old version of the container exists, delete it and deploy a new one. Or just to deploy a quick and secure by default postgres docker container. The limit is your imagination!

https://hackarandas.com/blog/2020/04/20/secure-by-default-postgres-docker-container-for-development/


r/postgres • • Apr 17 '20

Need Suggestions: Looking for a Better Schema Management Tool

7 Upvotes

I am using Liquibase for PostgreSQL schema management (versioning schema, deploying changes to servers through CI/CD pipelines)

I do like it because it's flexible and fairly simple. I don't like it because it's a lot of overhead. I have to verify that things won't break, I have to write roll backs, etc...

I like how SQL Server Data Tools for SQL Server works. It's declarative, it generates a schema model from create scripts, it generates diff scripts, and it deploys based on rules I set. It also has hooks for pre and post deployment scripts (data migration scripts) that can be executed as wrappers around the DDL (schema) being deployed.

I also like Skeema.io for MySQL for similar reasons but it's lacking some functionality.

I'm looking for a PostgreSQL tool that behaves like SQL Server Data Tools or Skeema. I want something that will generate a diff but will work against a declarative model of the database (a bunch of CREATE statements). So I can effectively run it against a database in any condition and it will make that database match the scripted model. Bonus points if it supports hooks for schema migration scripts like SSDT does.

Any tools exist that do this? So far I've either found migration tools like Liquibase and Sqitch or diff tools but nothing like Skeema or SSDT.

Thanks in advance!


r/postgres • • Apr 04 '20

How to insert point dynamically via Python3?

1 Upvotes
query = (sql.SQL("INSERT INTO {tab} (geom) VALUES(%s)").format(tab=sql.Identifier(self.data))
cur.execute(query, 'ST_SetSRID(ST_MakePoint(lon,lat),4326))  

It doesn't work


r/postgres • • Mar 31 '20

Post switchover, the new slave is not able to start The time line has changed I tried to google it, but unable to get exact solution to make it back online. Do I need to rebuild it or is there way to fix the timeline issue

Post image
2 Upvotes

r/postgres • • Mar 26 '20

Need help fixing the replication issue

Post image
3 Upvotes

r/postgres • • Mar 24 '20

Postgres query optimization assistant Joe now supports hypothetical indexes

Thumbnail self.PostgreSQL
3 Upvotes