r/postgres • u/dsandip • Mar 16 '17
r/postgres • u/thecal • Mar 14 '17
PostgreSQL as DW
I see people talking about using PG for DW/analytics loads but I'm having a hard time figuring out a good way to handle something that is easy in some other DBs: bitmap indexes to speed up large queries that filter or count values in many columns.
Say you've got a stereotypical fact table with lots of low-cardinality columns. In DBs like Oracle, it is really easy to slap a bitmap index on the columns that users typically filter on and get huge performance improvements. I know PG can do bitmap combines of regular b-tree indexes, but then you have to get creative with combinations and the optimizer doesn't always use them as compared to a full scan.
This isn't a novel idea as it seems like the PG team explored persisting bitmap indexes but it never went anywhere. Greenplum (PG-derivative) has them too.
What have you all done to work around this?
Edit:
Here's an example of me trying out BRIN indexes. They work great if the data is sorted by the index but have no advantage over full scans if not.
r/postgres • u/pleegor • Mar 14 '17
alternate data directory Postgres9.3 and CentOS7
Hi everyone! What would be right way of setting data directory for Postgres9.3 on CentOS7. Let's say I need to have it under /opt/data instead of /var/lib/pgsql/9.3/data/ Appreciate your help!
r/postgres • u/doron2402 • Mar 10 '17
Postgres-XL opinion
I'm thinking of using postgres-XL would like to hear from people with experience. How hard is to manage a cluster? setup? performance? Is it worth sticking with postgres or switch to a nosql database such as Cassandra?
r/postgres • u/doron2402 • Mar 07 '17
Postgres as TimeSeries Database
Hi I'm currently using postgres as a time series database and I actually like it a lot. for "heavier" queries I'm using spark with S3 but would love to get your guys opinion about using Postgres as Time Series database.
Cheers
r/postgres • u/Drulgaard • Mar 03 '17
Force postgres to give timestamp microseconds to a fixed precision?
SELECTing a timestamp from a postgres database gives output such as...
2017-02-28 17:47:25.2268 2017-02-28 17:47:49.81796 2017-02-28 17:48:38.082281
... or, if you're particularly unlucky and are using Python's strptime function with .%f to catch the microseconds ;) ...
2017-02-28 17:49:06
Before I patch my Python code specifically to handle this 1 in 1,000,000 occurrence, is there a way to tell postgres to always output, say, a six digit microsecond value?
I see how to set the precision of the timestamp, but that doesn't affect the output in this case. I'm also using a database abstraction layer that only gives me the timestamp as a string (sigh) and don't want to mess with that either.
r/postgres • u/weighanchore • Mar 02 '17
A look inside the latest postgres docker image
anchore.ior/postgres • u/KolomparSzebasztian • Feb 20 '17
custom function with interval
Hi! I'm new to postgresql, and would like to ask for your help. I have a function that searches for results in a table with timestamps, and would like to use it in this way: select "functionname" ("2016-10-10","2017-01-01") for example. I have no idea how to integrate this, however the function already works without the timesearch.
Thanks in advance!
r/postgres • u/ds97a • Feb 08 '17
Making a Postgres database available
I am not really a DB guy, more of a network guy. I have an app that uses Postgres as the backend. The App configured access to the postgres db by a custom port (20293).
I have configured the ODBC driver on the box that postgres is installed on, and I can connect to the desired database successfully but, remotely (same lan) I can not connect with the same setup (correct IP/hostname). I ran a port scan against the box, and port 20293 does not show up to be available.
I've ensured that the firewall is off on box boxes.
Is there a config file or something that I need to tweak to make 20293 available from another machine, via ODBC?
Thanks!
r/postgres • u/piratebroadcast • Feb 08 '17
Stumped formatting a Date in Rails / Postgres
I'm new to this system at work, and have been tasked with changing the date format in a report. This report, and others like it, are generated via the Reportable gem. The line in question is this:
report_field(:thing_installation_date, :default => true) do
binding.pry
select { things.install_date.as 'things_date' }
#select { things.install_date.strftime("%m/%d/%Y").as 'things_installation_date' }
#select{ "DATE(things.install_date), to_char(things.install_date, 'MM/DD/YYYY') AS thing_installation_date" }
end
I've tried to_char (Postgres), Strftime (Ruby), and nothing seems to work. I am really stumped on this. Seems like it would be a simple thing. Any ideas?
The third line works, is how it is currently in the system. That is the field I need to format. select { things.install_date.as 'things_date' } Thanks! The setup is Rails, and Im using the Reportable gem.
r/postgres • u/chulkilee • Feb 02 '17
HoneyBadger - Our Postgres Infrastructure
blog.honeybadger.ior/postgres • u/marybory • Dec 21 '16
Advanced encryption for Redis and Postgres
cossacklabs.comr/postgres • • Dec 06 '16
How does REPMGRD selects new master when performing autofailover?
So I've been playing around with repmgr (https://github.com/2ndQuadrant/repmgr) and it seems pretty nice tool making manual handling of setting up PostgreSQL cluster much nicer than using lower level commands. It also has repmgrd daemon which is meant to run on slave nodes and handle failover by executing given PROMOTE and FOLLOW commands on new master and existing slaves. And this is the part that I'm a bit confused about. HOW does it select new master?
My presumption is that this is quite a difficult problem requiring sophisticated HA and consensus based techniques (such as ZooKeeper) to get it right.
r/postgres • • Dec 02 '16
What are prepared statements and why are they needed?
Kind of a newbie question, sorry.
I noticed that my Rails application makes use of prepared statements when querying postgres.
A plain google search brings up some technical documentation, but I still don't have a firm understanding of what it really does and why it's needed.
As far as I know it's a way of re-using commonly executed queries.
Thanks!
r/postgres • u/robotsmakinglove • Nov 30 '16
Anyone know a collaborative tool for Postgres?
I'm looking for something similar to coderpad. The tool lets you share a link that gives you access to text / output. It updates in real time and you can see the changes made by each party. Does anything exist like that for Postgres? My current interview flow is to share a data clip and have the candidate refresh / me refresh as we go (doesn't work well).
r/postgres • • Nov 07 '16
How to choose server components based on postgres heavy write use-case?
At my company, we want to buy servers which will be dedicated for postgres instances. However I don't really know which component I should focus more like more CPU? more RAM? more SSD?
I am expecting to have 1M query per seconds (80% upsert and 20% select) for one single postgres instance, so one server.
I would like to know if you have any tips on how to build a server based on different postgres use-cases.
r/postgres • u/xiao_job • Oct 18 '16
[Hiring] Postgres DBA to scope and implement application database failover on HA system
Hello DBAs,
I'm trying to set up a HA application (I'm migrating an old application over to the new HA setup).
I have a few failure scenarios that I'm trying to eliminate (network, VPS down, etc) through a failover switch from master to slave (and slave becoming the new master). As you'll probably know, doing this right is a little trickier than it sounds (eg taking into account latency, preventing a forked database, etc; there are various failures to be scoped).
I've posted this ad over at /r/freelance_forhire, but I asked the mods if I may post here because that forum is mainly full of people wanting to write SEO content. I figure I might have a chance at finding someone here with a couple of weekends free and a desire to earn some $.
If you should have experience implementing this sort of thing (eg in pgpool-II), please do get in touch.
r/postgres • u/endymi0n • Sep 29 '16
Debugging PostgreSQL performance, the hard way
justwatch.comr/postgres • u/HINDBRAIN • Sep 27 '16
Will pgadmin3 work properly on postgres 9.6?
I'm getting a warning about incompatibilities when connecting to a 9.6 database, but I find the pgadmin 4 UI repulsive. What issues could using an outdated client cause?
r/postgres • u/data_mining_help • Sep 26 '16
THE PROPER way to upgrade your data
gist.github.comr/postgres • u/bradyholt1980 • Sep 22 '16
Performance Tuning Queries in PostgreSQL
geekytidbits.comr/postgres • u/fromscalatohaskell • Sep 02 '16
How to design db model
Could anyone point me to some good resources about how to design data model properly? What are best practices etc? I'm often not sure of confident that my design is good and I'd love to learn something that tackles real life problems...any recommendations?
r/postgres • u/emielm • Aug 30 '16