createdb command error : could not connect to database [closed]
I am using the following command for creating database in postgresql. createdb -D pg_default -E UTF8 -h localhost -p 5432 -U pramil -W pramil mydb but this command results prompt for password.When I...
View ArticleHow to do incremental/differential backup every hour in Postgres 9.1?
Trying to do an hourly hot incremental backup of a single postgres server. I have the following setup in postgresql.conf: max_wal_senders=2 wal_level=archive archive_mode=on archive_command='copy "%p"...
View ArticleSelect first row (grouping) + add aggregate function
First have a look at this question on StackOverflow. I’m looking to accomplish the same task, except I also need to add an aggregate function (PostGIS’s ST_Union) to my query. How can I combine the...
View ArticleCan't connect to the postgres server ls: /tmp/.s.PGSQL.5432: No such file or...
*Update*I included an update at the bottom of this post with details from the logs explaining the problem that I haven’t been able to fix. Following along with this Railscast...
View ArticleTOAST Table Growth Out of Control – FULLVAC Does Nothing
Recently, I’ve had a PostgreSQL 8.2.11 server upgraded to 8.4 in order to take advantage of autovacuum features and be in line with 30ish other PGSQL servers. This was done by a separate IT group who...
View ArticleHow do I get the aggregate of a window function in Postgres?
I have a table containing a two columns of permutations/combinations of integer arrays, and a third column containing a value, like so: CREATE TABLE foo ( perm integer[] NOT NULL, combo integer[] NOT...
View ArticleOptimizing PostgreSQL for transient data
I have several tables with 100-300 columns of integer types each, that hold highly volatile data. The datasets are keyed by one or two primary keys, and when refresh occurs, the whole dataset is...
View ArticleDump PostgreSQL without DROP DATABASE
I want dump a database, but, without DROP DATABASE, and CREATE DATABASE instructions, in .backup / .sql (generate file). Actually I use this command: pg_dump --format=c --no-privileges --no-owner...
View ArticleRepairing Broken Binary Replication in PostgreSQL 9.0
I have a binary replication that was stopped for so long that the WALs were removed and as a result, it ended up being old. I’m trying to reestablish the replication and the best way I’ve found so far...
View ArticlePostgres backup and WAL to S3
We are looking for a solution for the following problem: We have set up streaming replication so we have a master DB and a slave DB, we want to have basebackups and WAL files sent to our S3 storage...
View ArticlePostGIS – Geometry or Geography find points within distance in meters
I have a requirement where I need to store lat/long coordinates for locations all around the world. I then need to query for those locations that are within a specified distance (in meters) from...
View ArticleInconsistent query execution times using trigram indexes?
I have a table residences… I installed trgm: create extension pg_trgm; After adding trigram indexes to both grp and name columns using: CREATE INDEX residences_name_trgm ON residences USING GIN (name...
View ArticleSPI postgresql – insert data into table from postgres.c
I’m working inside postgres.c (inside exexc_simple_query) of postgresql 9.1 (line 1094 of http://doxygen.postgresql.org/postgres_8c_source.html#l00829 ). I need to insert some query information in a...
View ArticleProblem with Strava Like Identifying of Trails From a GPS Track
I’m playing around with creating some basic Strava-like functionality for a project and I’ve ran into a problem. I have a database of existing trails, the user uploads their gps track of a ride they...
View ArticlepgAdmin3 can't connect properly to Postgres 9.2
I have installed pgadmin3 version 1.10.2, however when it connects to PostgreSQL server version 9.2, it says: Warning: This version of pgAdmin has only been tested with PostgreSQL version 8.4 and below...
View ArticleCan I limit an index to only contain the newest relevant row?
I have a table in PostgreSQL 9.2 that records login sessions called user_login_session. This table contains a user_id, start_timestamp and end_timestamp columns, amongst others. This table has started...
View ArticleFailover – automatic switching between servers in Postgresql 9.1
I’m pretty new to Postgresql 9.1 and failover replication. We have a simple master-slave setup, for failover replication, which our application (client) is connected to. On a failure of the master, the...
View ArticleStoring data in PostgreSQL: One table or two?
I’ve just started using PostgreSQL 9.2 and my data consists of product prices at various points in time, usually a different price every month. Question: Because every product can have different prices...
View ArticleCan't set up witness in Repmgr 2.0
I am trying to setup repmgr using the autofailover quick setup tutorial provided on Github Link But I am kind of stuck on the witness section, when trying to create the witness with repmgr -d repmgr -U...
View ArticleStreaming replication in postgresql 9.1 — sender and receiver processes...
I’ve followed this guide, and cross-referenced the primary postgresql wiki in order to set up replication. I’ve configured postgresql.conf and pg_hba.conf as directed, and then restarted the master and...
View Article