PostgreSQL is a powerful, enterprise class, open source RDBMS. It has more than 15 years of active development and a proven architecture that has earned it a strong reputation for reliability and data integrity. It runs on all major operating systems, including Linux, UNIX and Windows. It prides ...

learn more… | top users | synonyms (1)

2
votes
2answers
2k views

How to toggle a boolean field by sql in postgresql?

There is a field show which is a boolean type in postgesql. I want to write a sql to update that table, to toggle the value of show. If it's true, it becomes false, if it's false, it becomes true. ...
3
votes
1answer
902 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 ...
5
votes
2answers
5k views

Why did Postgres UPDATE take 39 hours?

I have a Postgres table with ~2.1 million rows. I ran the below update on it: WITH stops AS ( SELECT id, rank() OVER (ORDER BY offense_timestamp, defendant_dl, ...
3
votes
1answer
404 views

querying a linked PostgreSQL database in SQL Server 2008

We will be deploying an application with a Postgres back-end and need to provide report writing capabilities in SQL Server. I am exploring options for real-time or near real-time reporting in this ...
3
votes
1answer
553 views

Creating UUID extension as the non super privileged user

I need to load the uuid extension on my database, which is being created in runtime. The user that created the db is not superuser, she only has the "CREATEDB" permissions. Is there a way to do this? ...
2
votes
1answer
243 views

Postgres synchronized backup - what's with the archive?

I am setting up a Postgres 9.1 master and a hot standby-server. I read the documentation but I'm not quite sure yet what I should do with my WAL files. Every commit is done on both servers before ...
1
vote
1answer
173 views

Working of window functions and idea window size for window function

I am not able to understand the concept of window functions. How exactly they work and what are the pros and cons of such technique? I have read that using limit and offset is slow but its still ...
5
votes
2answers
1k views

Postgres full text search with multiple columns, why concat in index and not at runtime?

I've come across full text search in postgres in the last few days, and I am a little confused about indexing when searching across multiple columns. The postgres docs talk about creating a ts_vector ...
2
votes
2answers
4k views

How to convert postgresql dump files to oracle dump files?

How can I convert postgresql dump files to oracle dump files? If anyone has experience in this, or knows of an open source tool I can use, please share it with me.
3
votes
1answer
1k 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 ...
2
votes
1answer
296 views

Disable automatic login in pgAdmin

I have enabled automatic login in pgAdmin and would like to disable it to make it possible to connect to the servers using different roles. How do I do this?
1
vote
1answer
609 views

Tutorial for installing and setting up 'streaming replication' with PostgreSQL on Windows XP

Please refer to the diagram in the link below. While looking at my goals. http://i.stack.imgur.com/GkVWb.png GOAL: Get PostgreSQL 9.1 running on 3 terminals on the 'on site' location. 'on ...
2
votes
1answer
935 views

Postgres multiple joins slow query, how to store default child record

Ive got a small database in Postgres, about 10,000 records storing company customers. I have a "slow" performing query (about half a second) which is performed very frequently, and my boss wants me to ...
2
votes
2answers
2k views

Reindexing a large database

I have a very large database (millions of rows) which has been indexed. I receive a diff of rows from another source that I need to update in my database. The problem I am facing is that is it ...
5
votes
1answer
2k views

PostgreSQL: Unable to run repmgr cloned database

I'm running tests with PostgreSQL hot standby with 1 master, and exactly 1 slave. I am using the instructions on this guide: ...
1
vote
0answers
200 views

PostGIS: Remove stale/obsolete geometry columns from the geometry_columns table [closed]

I understand that the function Populate_Geometry_Columns() inserts records in the geometry_columns table for geometry columns that are not yet listed there. However, an invocation of ...
1
vote
2answers
477 views

pg_upgrade fails with an unspecified error

I’m running Postgres 9.1’s pg_ugrade to migrate from 9.0 to 9.1 on Windows x64. After editing the permissions to allow full trust, running the tool as the postgres user, and working around a bug ...
4
votes
1answer
900 views

PostgreSQL versus MySQL for EAV structures storage

Is there any practical difference or what are the advantages of using Postgres 9.x versus MySQL 5.x for storing EAV (Entity-Attribute-Value) structures, especially in terms of read performance?
5
votes
1answer
115 views

Upgrade postgres without messing with ports?

The standard procedure for upgrading Postgres appears to require that I temporarily run both the old and the new version. This means that I have to change the port of the old version. This seems ...
3
votes
1answer
479 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 ...
4
votes
1answer
3k views

What is the meaning of n_live_tup and n_dead_tup in pg_stat_user_tables

What is the meaning of n_live_tup and n_dead_tup in pg_stat_user_tables or pgstattuple?
0
votes
2answers
5k views

Opening a .backup file for PostgreSQL

I'm going to warn you that whoever explains this needs to talk to me like I'm five years old, because this is something way, way beyond my level of expertise. In short, I have what I think is a ...
2
votes
1answer
181 views

Multiple databases, in multiple geographic locations while preserving PostgreSQL triggers and data consistency

I've read a ton over 300 pages of db setups in the last day but I feel a little overwhelmed with all of the potential options and lack of documentation on how PostgreSQL triggers function across ...
1
vote
3answers
516 views

access columns returned by psql from bash

I want to use value returned by psql in bash. This is the script: psql "connection parameters" -c "SELECT pg_database_size('dbname');" The output is like this: pg_database_size ...
1
vote
1answer
535 views

How to know how many lines are copied from table - psql

I want to write a script to backup a table using COPY. psql "connection parameters" -c "COPY (SELECT * FROM tbl WHERE insertion_date > 'date') TO STDOUT WITH CSV HEADER;" | bzip2 -c > ...
9
votes
1answer
13k views

How to use psql with no password prompt?

I have wrote a script to REINDEX many indexes in a database. Here is one of them: echo -e "\nreindex for unq_vbvdata_vehicle started at: `date "+%F %T"`" >> ${LOG_FILE} psql -U ${USERNAME} -h ...
3
votes
1answer
1k views

PostgreSQL Scheduled Database Backup

For scheduling a daily back up on a postgres database we execute the following command: 0 2 * * * /usr/local/pgsql/bin/pg_dump -Fp -b -U database_name \ > ...
4
votes
1answer
1k views

Dropping unique constraint on PostgreSQL table taking 10+ hours

We have a PostgreSQL database with a fairly large table (~50 million rows). The table has a unique constraint across several columns, each of which is indexed. For context, I recently deleted about ...
2
votes
1answer
2k views

How to import the data of postgres 8.x to postgres 9.x

My OS is windows 7 x64. I was use postgres 8.4, and all databases are in postgres/8.4/data. Yesterday, I reinstalled my os system, but I found I can't install postgres 8.4 anymore (there is always an ...
4
votes
1answer
3k views

How to get actually allocated tablespace size by each postgres database?

Postgres tablespace is cluster-wide. Therefore, how do I caculated how much space allocated by each database in postgres tablespace ?
3
votes
2answers
1k views

Is Tablespace something like Logical Volume?

I'm confused about tablespaces in PostgreSQL. Is it something like LVM? I mean when disk is getting full, can we add another disk, format and then CREATE TABLESPACE tblspace LOCATION ...
1
vote
1answer
502 views

Triggers not being run on a partitioned table

I'm using PostgreSQL. I have a table that I have partitioned into three sub-tables - and as far as I can tell, this all works correctly. Rows are correctly inserted into the appropriate partition and ...
0
votes
1answer
336 views

PostgreSQL: Trouble accessing another server's Data via NFS

Background: I'm working on a 2-node High Availability PostgreSQL database cluster for my company. The system has a master/standby setup where the standby takes over the duties of the master when the ...
4
votes
2answers
404 views

Huge database logging of event type rows and ways to optimize it

We have a database that stores events. Events are generated at a 1000 per sec rate. We need to keep these events accessible for some years. Usual use of these events is selecting some of them from the ...
3
votes
3answers
1k views

OCIEnvCreate failed to create environment handle after installing oracle_fdw

I have installed oracle_fdw successfully. After I create extension oracle_fdw and foreign table it shows the following error. Is this a server configuration problem? --env Oracle : 10.2.0.1 ...
0
votes
1answer
307 views

Update Postgres on server that already has version included with system

Mac OS X (Lion) Server includes Postgres (9.0.5) that it uses for some system utilities (Wiki server, caldav, etc.). I'm about to start using this server for some Rails applications and am wondering ...
7
votes
1answer
2k views

PostgreSQL Failover - What tools should I use?

Here is the scenario: There are two machines running CentOS 6.2 - machine0 and machine1 Both have PostgreSQL 9.1 installed. One of them should be active, as a master system and through asynchronous ...
1
vote
1answer
97 views

Impact of changing schema name

I have a server with two databases. Each database has a different schema name despite the fact that DB2 is a subset of DB1 (DB2 has a subset of the tables in DB1). Not withstanding any code changes ...
5
votes
4answers
2k views

Trouble setting up Postgres for the first time

I have some, albeit limited, experience with MySQL and MongoDB (both running fine on server) but having trouble with Postgres and find the documentation lacking for newbies, like myself. Postgres is ...
6
votes
1answer
1k views

Postgresql performed a “fast shutdown” by itself. Why? How was it able to do that?

I've already googled and manual read as much as I could before posting this here. Version info: Postgres8.4 on Ubuntu10.x I have a personal laptop that I run a postgres server on, and a Java script ...
2
votes
2answers
398 views

Joining based on date (or date range)

I'm not sure if I've completely fudged the design of my small hobby database (I'm not a DBA by any means), but I have a table like this (primary key is (staffid, effectivefrom)): staffid | target | ...
1
vote
1answer
236 views

Postgres shared_buffers and pooled processes

I have read several articles (including Postgres docs) that suggest setting the shared_buffer's config value to 25% of your total physical memory. Using my 4 GB memory as an example... If I ...
0
votes
1answer
116 views

What DML commands can be allowed / limited on a reporting server?

I have a largish database (PostgreSQL 9.1) which I'm preparing to replicate using streaming replication. The 2nd server will be used for reporting and backup purposes. When building reports, it's ...
1
vote
1answer
1k views

Postgres: trying to fix some unicode encoding issues

I've got a postgres 8.4 database with a few mangled characters in one of the columns on a table. For example, the word "don't" gets displayed within psql as: donâ\u0080\u0099t I want to be able to ...
6
votes
2answers
461 views

PostgreSQL Complete Database Backup

I've been trying to figure out how I can completely backup my PostgreSQL database. I have not seen any resource that explains how to do a complete backup. I am aware of the pg_dump and pg_dumpall ...
0
votes
2answers
212 views

Attempting to avoid SORT in query planner

I have a query that is used VERY frequently in my application. Without modifying the query itself, I'm trying to optimize it by toying with different indexing schemes. Here's the query (basically): ...
2
votes
1answer
481 views

PostgreSQL partitioning query performance inexplicably bad

I find this a bit mysterious. The cost of getting the maximum value out of just the partition parent table (which is empty) is very cheap: evlampts=# explain select max(timestamp) from only mcdata; ...
1
vote
2answers
698 views

Postgresql 9 table lock resolution

I have an ALTER TABLE statement that according to pg_stat is "waiting", and I'm wondering if there is an easy fix to allow the statement to execute? From my limited understanding I think it's a ...
9
votes
1answer
344 views

Disk file effects of delete and vacuum

I have a very frequently updated table with 240 million rows (and growing). Every three hours 1.5 million rows are inserted and 1.5 million are deleted. When I moved the cluster to a SSD this bulk ...
1
vote
1answer
192 views

Slow enumeration of schemas and tables in a largish database

We have a Postgresql 8.4.8 database server on a Debian system with a database that has 500+ schemas with roughly 300+ tables each. The schemas and tables are created by scripts, we cannot influence ...