PostgreSQL is an enterprise class, open-source, object-relational database management system (ORDBMS) available for all major platforms including Linux, UNIX, Windows and OS X. Please mention your exact PostgreSQL version when asking questions.

learn more… | top users | synonyms (1)

3
votes
1answer
3k views

Postgres is stuck in recovery mode

I have a stand-alone instance of PostgreSQL which is in recovery mode. It has been saying 2014-03-24 18:45:57 MDT FATAL: the database system is starting up For many hours, and ps shows: postgres ...
3
votes
1answer
2k views

Postgresql subquery speed much slower than individual queries

In Postgres 9.1. I am attempting to do a single query to get the timezone of a given postal code. I have data loaded in my database, and I am using PostGIS to store the coordinates of each postal ...
3
votes
1answer
71 views

restarting postgresql quickly

I'm reading over the postgresql admin cookbook. Some of the database server parameters require a restart and with a busy database, you may need to restart quickly. There are a number of things to do ...
3
votes
1answer
217 views

PostgreSQL - VACUUM FULL does not free space back to the OS

On a Postgres 9.1 installation, I'm trying to reduce the amount of Postgres' disk usage by dropping records from tables and then running VACUUM FULL on those tables. My understanding of VACUUM FULL is ...
3
votes
1answer
172 views

Postgresql query slowed with table growth

I have a very simple table in Postgresql, and need some guidance to speed up my queries. Recent large expansion of the data in the table has made everything grind to halt. Table body_feature: ...
3
votes
1answer
752 views

PostgreSQL Streaming Replication - Slave remains in recovery mode

PostgesSQL 9.3.x I cannot run some commands on slave because: "ERROR: recovery is in progress" I set up streaming without archive. Initialized with pg_basebackup. Dataset has about 180GB . This is ...
3
votes
1answer
357 views

PostGIS ERROR: operator does not exist: postgis.geometry @ geometry

I have had PostgreSQL 9.3.1 and PostGIS 2.1.0 installed (via https://github.com/PostgresApp/PostgresApp/releases/tag/9.3.1.1-RC1) and working on my laptop for some time, and have been doing Ruby ...
3
votes
1answer
99 views

selective undoing of commited transactions in PostgreSQL

I have inherited a small (<1M rows) PostgreSQL DB which contains complex business rules split across several tables. Updates are very light, reads not so heavy, but the data is extremely valuable. ...
3
votes
3answers
5k views

PostgreSQL: How to backup only One Schema from a database and restore it on another server

I have a database named "A" which has two schemas "B" and "C". I want to backup and restore Schema "B" on a different server? not sure how to do this as I am new to Postgres. Do I have to create a new ...
3
votes
1answer
104 views

Migrating database live while being severely handicapped

I "inherited" a web application which is designed and implemented horribly (both the application and the database). For example, the main data is stored using a sort of emulated key-value storage in a ...
3
votes
1answer
232 views

Problem with PostgreSQL and the geqo optimizer

I'm trying to compare the two execution plans (exhaustive search and geqo) from the optimizer, but I always get the same plan from both types. These are the variables I use for geqo: SET geqo = true; ...
3
votes
2answers
3k views

What am I doing wrong with pg_hba.conf?

I'm trying to make it so that local connections to the database don't require a login. So I added the line local all all trust to the pg_hba.conf file, but then when I load pgAdmin and try to ...
3
votes
1answer
597 views

PostgreSQL COPY: is it always faster to delete and recreate indexes?

In this answer, Erwin Brandstetter recommends It is also substantially faster to delete indexes before a huge bulk INSERT / COPY and recreate them afterwards as it is much more costly to ...
3
votes
1answer
127 views

Streaming replication setup, sane setup?

Not being a DBA as main profession, I would like to know if the following assumptions are true. I have been searching the net for days and I think I have understand it correctly, but I would like to ...
3
votes
1answer
92 views

Workaround the snapshot isolation in a writable CTE

The postgres docs say: The sub-statements in WITH are executed concurrently with each other and with the main query. Therefore, when using data-modifying statements in WITH, the order in which the ...
3
votes
2answers
71 views

disallow SET command in a postgresql server

Im planning to publish my postgresql server to a few untrusted clients. I dont want them to modify any runtime setting, like work_mem or something risky to my server. In general I assume the ...
3
votes
1answer
115 views

Postgres caching and bytea

I have a DB which, among other things, stores images (as bytea, if that's interesting). It also stores users' metadata, activity logs, etc., but images currently take 500MB out of the total 600MB ...
3
votes
1answer
75 views

Does avg_query for PgBouncer include update and inserts?

Trying to tune our application and would like to know if the stats data that pgBouncer shows as avg_query, according to the PgBouncer docs on usage: avg_query Average query duration in ...
3
votes
1answer
493 views

Variable substitution in psql when using \copy

I'm using the psql command \copy and I would like to pass a variable to it from the shell (for table name) like I've done when scripting queries. I've read in the documentation for psql that: The ...
3
votes
1answer
609 views

Can't understand results of pg_stat_statements view

I configured my postgresql.conf (my version is 9.1) with the normal persistent configuration: shared_preload_libraries = 'pg_stat_statements,plperl' custom_variable_classes = ...
3
votes
1answer
542 views

Execution plan in simple query in PgSQL depends on offset clause, why?

Update on 2013-01-16 11:08: see below I am working on PostgreSQL 8.4.14 with the following table fed with 53k lines: CREATE TABLE botany.taxon_data_cache ( taxon_id int NOT NULL, ...
3
votes
1answer
891 views

Distinguish between schema and database

I had the error cross-database references are not implemented: scan.location.alias with this PL/pgSQL code: DECLARE v_tmp_host scan.location.alias%TYPE; v_ip_address character varying; BEGIN ...
3
votes
2answers
78 views

Looking for a possible multi-column index

I have a table highscore containing the columns: game (text) date (timestamp) score (integer) more irrelevant ones... The query most often run on it is: SELECT * FROM highscore WHERE game = ...
3
votes
1answer
294 views

Postgres Plus Cloud Database on AWS for write heavy social game?

I'm one of four founders of a big social gaming iPhone app in Sweden. We now suffer from severe database server issues so I'm turning to you guys to get some help. First of all, let me get this out ...
3
votes
1answer
679 views

High availability in postgresql

We will be switching from mysql cluster to either postgresql or oracle (with RAC). Mysql cluster is quite reliable, but lacks features in SQL that make programmers life easier (they consider it as ...
3
votes
1answer
2k views

How can I create a dblink from Postgresql 8.3 to SQL Server (2000 and 2008)?

I have a Postgresql database that need to read data from two SQL Servers (one SQL Server 2000 and one SQL Server 2008). I want to setup two dblinks to the SQL Servers. After googling, foruming, ...
3
votes
1answer
2k views

Postgres: Server does not listen even listen_addresses is set to '*' in postgresql.conf

I've set listen_addresses to '*' in postgresql.conf and stopped/started Postgres to "reload" configs. Even then, psql SHOW listen_addresses; is showing localhost. I'm sure I've edited and saved the ...
3
votes
1answer
580 views

Retrieving queries when the hour of starting timestamp is less than the hour of ending timestamp

I have a CTE-based query in which I retrieve hourly intervals between two given timestamps. My query works as following: Getting start and end datetimes (let's say 07-13-2011 10:21:09 and 07-31-2011 ...
3
votes
1answer
3k views

PostgreSQL 9.1 vs MySQL 5.6 with InnoDB ? Which is better for scaling?

PostgreSQL 9.1 vs MySQL 5.6 with InnoDB. I do know that PostgreSQL offers better SQL features. I am currently using MySQL 5.6 lab release (the one with InnoDb full text search feature)(not in ...
3
votes
1answer
2k views

Why is my postmaster process (sometimes) becoming unmanageable after a WAL base restore?

TL;DR: Un-stoppable, unusable postmaster is being spawned when Postgres is started right after restoring its data directory from a WAL base backup. Why? Context: We run postgresql 8.4, on CentOS 6, ...
3
votes
2answers
4k views

Tool for Reverse Engineering of PostgreSQL Database on Linux (Ubuntu)

Please suggest a tool to reverse engineer a PostgreSQL DB into an entity-relationship-diagram (ERD) or equivalent ?? Ideally, I'm looking for a simple ERD or UML class diagram in a format that is ...
3
votes
1answer
339 views

PostgreSQL memory spike upgrade from 8.2 to 9.1

We recently upgraded a few of our development computers from PostgreSQL 8.2 to 9.1, with plans on eventually upgrading our production servers. Everything seems well with the restore of the databases, ...
3
votes
1answer
386 views

Oracle to PostgreSQL

I'm having som test databases running Oracle 10 & 11 that I plan to try to migrate to PostgreSQL. Some googling hinted that the perl script "ora2pg" could be of use, and free of charge. However, ...
3
votes
3answers
749 views

How do I design a database for continents, countries, regions, cities and POIs?

I am not a database designer so I'm having trouble designing database with GIS information. The goal is to create a system with continents, countries, regions (including states, sub-regions, ...
3
votes
1answer
204 views

PostgreSQL synchronized commit performance

I'm setting up a pair of PostgreSQL servers. Because cash is short I can only afford one high class server and some crapy backup box. If the expensive high end box should catch fire, operations can ...
3
votes
1answer
1k views

PostgreSQL 9 'pgstats wait timeout' problem

I'm asking about this here because in the PostgreSQL mailing lists no one answered me. In one of my servers (Windows 2008 R2 Standard/PostgreSQL 9.0.5 64 bits) the logs are being flooded with the ...
3
votes
1answer
2k views

Difference between table fillfactor and index fillfactor

In Postgres, one can set fillfactor for an index as well as a table. What is the difference? How to decide values for either. What are the usecases? I am trying to cluster a spatial relation on a ...
3
votes
1answer
579 views

PostgreSQL WAL Archiving: Does having archive_mode set to 'on' without copying logs cause performance issues?

Using PostgreSQL 8.4/CentOS 6: if I set the archive_mode parameter to on in postgresql.conf, but don't actually store the generated WAL files anywhere via the archive_command parameter, is there any ...
3
votes
1answer
1k views

Working across multiple PostgreSQL database servers

So we are writing an app whose schema should reference data which lies currently in an external PostgreSQL instance. We are negotiating being able to put our schema within the external database, but ...
3
votes
1answer
2k views

Any Idea how to migrate from PostgresSQL 8.4 to PostgresSQL 9.1.1 in opensuse12.1

I had a crashed opensuse 11.3 that's why I installed opensuse 12.1.. after I installed (via yast) and edited /etc/passwd I do this: rcpostgresql start and this shows on the /var/log/messeges ~ ...
3
votes
1answer
1k views

Postgres uuid: Use as primary key, or in addition to SERIAL -for disconnected app-

For a new SASS app with postgres 9, that will support disconnected clients. The client not will use the regular IDs, only the UUID. The clients will be on iOS, html5/python and perhaps later on other ...
3
votes
2answers
646 views

How do I configure PostgreSQL 8.3 to log bind parameters?

I'm running into some unique constraint problems with my database. I can't reproduce them, but see error messages from our production system: exception 'UniqueViolation' with message ...
3
votes
3answers
699 views

ts_rank massively slows my query, how can I improve performance?

Here's the table definition Table "public.kb_article_contents" Column | Type | Modifiers ------------+----------+----------- article_id | smallint | not null contents | text | not ...
3
votes
0answers
17 views

Restoring plain-text pg_dump with psql and --disable-triggers

I had to perform some tests with a short script to update some "legacy" data in one of my tables. Cautious as I am, using an untested script, I decided to backup the relevant table before doing so. ...
3
votes
0answers
84 views

Can't get Dell PE T420 (Perc H710) perform better than a MacMini with PostgreSQL

It's months that I'm trying to solve a performance issue with PostgreSQL. SYSTEM CONFIGURATION Our deployment machine is a Dell PowerEdge T420 with a Perc H710 RAID controller configured in this ...
3
votes
0answers
44 views

Postgres pg_basebackup reports directory exists but is not empty

I have postgreSQL 9.4.1 installed on a Win 2012 Server. I am looking to setup replication between this and another server of the same spec. So I am following guidance on preparing the master ...
3
votes
0answers
49 views

Get inserted row count when master table isn't modified

I have a partitioned table where data resides only in the child tables. The master table has an insert trigger that will distribute inserted data into appropriate child tables. Now, I need to create ...
3
votes
0answers
109 views

Slow transactions, many locks

At high load conditions the server app stops responding to client because begin/commit statements are executing very slowly (some take 15 seconds). The queries are simple - insert, update two columns ...
3
votes
0answers
88 views

Recovery when failover

1/ Description: I have 2 Centos machine: master, slave (streaming replication). Both of them are built on PostgreSQL 9.3 (image below) and configured failover event (failover PG 9.3 document). Last ...
3
votes
1answer
224 views

Monitoring Amazon RDS with pgtop

I recently migrated a Postgres database to Amazon RDS and I am lacking a good live monitoring tool. I tried pgtop, but I can't get it to work on Amazon. I can see the header with the DB statistics ...