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)

2
votes
2answers
213 views

Which performance can I expect?

I'm running a Postgres 9.1 database on a Debian Squeeze server. It's a paravirtualized XEN guest system with 4G RAM and 1 CPU core, based on a i7-2600 host system with Linux software-RAID1. I'm ...
3
votes
1answer
504 views

How to stabilize performance on frequently updated table in PostgreSQL

I'm trying to find-out a way how to prevent performance degradation in my PostgreSQL database. The table is updated every minute with 100,000 - 200,000 INSERTs. Every 5 minutes the table is updated ...
3
votes
1answer
239 views

A 'deeper' PostgreSQL autovacuum

We have a PostgreSQL 8.3.7 database suffering severe bloat after an algorithmic change. Unfortunately upgrading isn't an option at this time. For a particular group of partitioned count roll-up ...
2
votes
2answers
522 views

Is it a good idea to move high-volume and highly-accessed tables to a separate database?

Ours is a web-based application (built on multi-tenant architecture) running PostgreSQL v9.1.3. There are about 450 tables in our application, out of which 2-3 tables, specific to a module in the ...
2
votes
1answer
645 views

PostgreSQL psql - not working but no errors [closed]

I'm a complete noob to PostgreSQL, so I'm probably missing something completely obvious. Connected to my local db via psql on terminal. Any command I run to make db changes, or even a simple select ...
1
vote
2answers
2k views

Move postgresql database from one server to another

I have created a (spatial) database at my home which is several gigabytes and I want to move the whole database as it is from one computer my works computer. Nothing fansy, I will create a new ...
5
votes
2answers
9k views

PostgreSQL: changing password for a user is not working

I installed PostgreSQL on EC2 machine and now I want to change the password of user postgres I do $ sudo -u postgres psql psql (9.1.5) Type "help" for help. postgres=# ALTER USER postgres WITH ...
3
votes
2answers
741 views

postgreSQL update set only where cast is possible and ignore error?

I have 2 columns in a PostgreSQL table. The mac_address_temp column is for migration from character type to MAC-address type: mac_address | macaddr | mac_address_temp | character ...
3
votes
1answer
2k views

Will FK ON UPDATE CASCADE work?

Intuitively, adding the option ON UPDATE CASCADE to a foreign key constraint will have the effect of updating all referencing columns with the updated value of the key. Would that really work? ...
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
2answers
2k views

How to conditionally stop a psql script (based on a variable value)?

Let's consider the following example (from the start of a psql script): \c :db_to_run_on TRUNCATE the_most_important_table; -- tried to avoid similarities to anything that exists out there Now if ...
2
votes
1answer
124 views

Unique foreign key constraint between three tables

I'd like to track appointment attendances. Visitors can have appointments, or they can just turn up. If they have an appointment, and miss it, in which case I'd like to record a reason for the missed ...
4
votes
1answer
513 views

Permissions to delete large objects

Since PostgreSQL 9.0, each large object has its own access rights that are granted with: GRANT { { SELECT | UPDATE } [, ...] | ALL [ PRIVILEGES ] } ON LARGE OBJECT loid [, ...] TO { [ GROUP ] ...
2
votes
2answers
481 views

How do I save functions to individual files in PostgreSQL?

I maintain a legacy application that uses a PostgreSQL database. The application is heavily dependent on stored procedures (aka functions). I want to save these functions to files named after the ...
1
vote
2answers
215 views

PostgreSQL replication and large import

I am tasked with making large PostgreSQL imports to master instance, and then replicate it across the nodes as read-only data. Still, the CMS system has to be able to write data and replicate across ...
2
votes
1answer
79 views

Discovering databases with specific table on a PostgreSQL server

Is there a way for a non-admin PostgreSQL user to discover which databases it can access on the server it is connected to, more specifically which of these databases have a table with a specific name ...
3
votes
2answers
3k views

Problem with permissions for user

Hi I'm trying to create a login role (user) with a fairly minimal ability to modify the database. They should be able to select, delete, create triggers, insert and update. I would then like to have ...
6
votes
1answer
6k views

How to use aes-encryption in PostgreSQL?

I tried aes-encryption by using following statement: SELECT encrypt('test', 'key', 'aes'); which worked, but I am not able to decrypt the value. I inserted it in a field of datatype bytea but I'm ...
5
votes
2answers
4k views

How to turn off header only in psql (postgresql)

I'm using PostgreSQL 9.1.X I am trying to build psql script to print results without a header but including a footer. http://www.postgresql.org/docs/9.1/static/app-psql.html From the document ...
3
votes
1answer
1k views

Is it possible to configure PostgreSQL to automatically close idle connections?

Clients connect to our PostgreSQL 8.3 database but leave the connections opened. Is it possible to configure PostgreSQL to close those connections after a certain amount of inactivity?
2
votes
1answer
3k views

PostgreSQL: Change default port used by utilites like psql, createdb, etc

I have 2 instances of PostgreSQL running on some servers. One on the default port (5432) and the other instance on port 5433. Some users (and processes) only need access to the second instance (5433) ...
3
votes
1answer
516 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 ...
1
vote
1answer
226 views

What is the purpose of the keyword “ID” in PostgreSQL?

I'm new to PostgreSQL and I ran into problems using the following query: SELECT * FROM table1 WHERE ID = 1 ERROR: column "id" does not exist LINE 2: WHERE ID = 1 where ID is a column I ...
1
vote
2answers
202 views

postgresql sticking “enable_seqscan=False” in a UDF sensible?

I have a query which is taking 40 seconds to execute over the 80ms that it should if postgres where to filter off the primary key rather than doing a sequential scan. I have to force postgres to ...
1
vote
2answers
4k views

PostgreSQL hardware reguirements

What is the memory/cpu/other requirements to run PostgreSQL database server efficiently ? Is a way to appoint a hardware configuration for some sort of requirements - for example number of users, ...
6
votes
1answer
7k views

Scalability limitations of PostgreSQL and MySQL

I've heard that performance of non-sharded relational database such as MySQL or PostgreSQL "breaks" beyond 10 TB. I suspect that limits as such do exist as one would not come up with Netezza, ...
1
vote
1answer
71 views

Deadline rule date input after now

Hi I'm trying to find a way to ensure deadlines inputted are later than the current time and date. Currently I'm attempting this with a rule. CREATE OR REPLACE RULE "DeadlineInput" AS ON INSERT ...
1
vote
2answers
1k views

Too many TIME_WAIT connections in PostgreSQL

I am using PostgreSQL 9.0 on Centos 5.7 Final. At any given there are around 1,500-2,200 connections open for PostgreSQL on port 5432 which are in TIME_WAIT state. I have a feeling this is not good. ...
2
votes
1answer
923 views

Postgresql WAL Archiving, How to do it properly?

Basically I have one (for now) mission critical postgresql database that I will need up to the minute recovery for, I've never implemented a working WAL archival before so I would like to know what is ...
5
votes
3answers
2k views

Maximum number of databases for single instance of PostgreSQL 9

Developing a multicustomer application we plan to use a different database for each customer. But it could be more than 1000 customers (applications). Will PostgreSQL handle it without any problems? ...
1
vote
1answer
106 views

postgres 9.1: both md5 and ident on the same connection type?

In pg_hba.conf, is there a way to enable both 'ident' and 'md5' for local connections? Concretely, I am happy to have 'ident' turned on for humans to interact with the database. However, if I set up ...
13
votes
3answers
8k views

Measure the size of a PostgreSQL table row

I have a PostgreSQL table. select * is very slow whereas select id is nice and quick. I think it may be that the size of the row is very large and it's taking a while to transport, or it may be some ...
4
votes
4answers
9k views

How to list all views in SQL in PostgreSQL?

How do I list all views for a database using an SQL command in PostgreSQL? I would like something similar to output of the psql \dv command, but preferably just a list of view names. e.g., SELECT ...
12
votes
2answers
2k views

PostgreSQL procedural languages - differences between PL/pgSQL and SQL

Can anybody please summarize the differences between: http://www.postgresql.org/docs/9.1/static/xfunc-sql.html and http://www.postgresql.org/docs/9.1/static/plpgsql.html ? Main points: ...
4
votes
2answers
4k views

COUNT and SUM at the same time after removing duplicate rows

I'm using PostgreSQL and I can't figure out a query for doing a COUNT and a SUM of two different columns. Basically I'm looking for something like a SUM(hits DISTINCT record_id) The table: status ...
1
vote
1answer
377 views

TimeZone parameter in postgresql.conf

postgresql documentation says: All timezone-aware dates and times are stored internally in UTC. They are converted to local time in the zone specified by the timezone configuration parameter ...
2
votes
4answers
9k views

What GUI tools can be used for PostgreSQL in Mac OS X? [closed]

I have recently started using PostgreSQL with my rails app. I was looking for a SQL GUI to the PostgreSQL database (for Mac). Anything better than pgadmin3?
8
votes
4answers
1k views

How to check if a subquery has exactly one distinct result and a specified value concisely?

I found myself writing the following: select 'yes' where exists(select * from foo where val=1) and not exists(select * from foo where val<>1); and wondering if there is a more concise way ...
9
votes
1answer
5k views

How to get notices to the output stream?

I have debugging messages in functions. Those message are raised like RAISE NOTICE 'Value of id : %', id; I set my log file with \o messages.txt Then I do what I need to do with \i process.sql And ...
2
votes
1answer
282 views

Constrain input to a few different strings

Hi I can't seem to get a constraint working the way I expect in postgreSQL. From within pgadmin I execute the following SQL query. -- Check: "TypeCheck" -- ALTER TABLE "ComLog" DROP CONSTRAINT ...
4
votes
1answer
536 views

How large should my pool size be? And should I use pgbouncer?

I have a Rails application with 4 Unicorn workers. How do I determine what postgresql database pool size I should use? And if I have 6 applications connecting to this postgres database, would that be ...
11
votes
2answers
756 views

Modelling constraints on subset aggregates?

This is a cross-post from Stack Overflow. I figured I might get more interesting thoughts here. I am using PostgreSQL but I figure most of the top-end db's must have some similar capabilities, and ...
4
votes
2answers
2k views

How to force Windows to support not supported LC_COLLATE and LC_TYPE in PostgreSQL?

I have fresh installation of PostgreSQL 9.1.x. Unfortunately, I discovered that OS doesn't support LC_COLLATE = 'pl_PL.utf8' and LC_CTYPE = 'pl_PL.utf8'. I read in PostgreSQL documentation that: ...
10
votes
2answers
483 views

Postgres query plan of a UDF invocation written in pgpsql

It's possible when using the pgadmin or plsql to get a hold of a query plan for a sql statement executed via a UDF (using EXPLAIN). So, how do I get a hold of the query plan for a particular ...
0
votes
1answer
803 views

WorkAround for PHP PDO(with libpq V 9.1.4) binding for use of CITEXT?

The scenario Two systems(not server) running PHP and PostgreSQL with the following versions Fedora 15: PHP PHP 5.3.13 (cli) (built: May 9 2012 14:38:35) Copyright (c) 1997-2012 The ...
-1
votes
1answer
290 views

Database for an application similar to Chatroulette

I am making an app that is similar to Chatroulette. When a user starts the app it finds someone that is not currently talking to anyone and have them talk to each other. At any point a user could ...
4
votes
2answers
807 views

Pros and Cons of virtualisation technology for database-server and datastorage

Yesterday we had a chat about performance and restorability and I realized how many good things a virtualisation environment can bring to me - but as I'm a little sceptic concerning performance I'm ...
2
votes
3answers
4k views

Copy PostgreSQL data from one PC to another

I am migrating my server application from the existing system to another system. Unfortunately, the existing system is also the database server. It has data stored. Is it possible to copy this data to ...
2
votes
4answers
4k views

PostgreSQL import CSV File causes Syntax Error

I'm attempting to import a CSV file into a database via the "COPY" command; however, I get the (what seems common) error that I need to be a superuser and that I should use "\copy" instead. However, ...
5
votes
1answer
4k views

disable constraints before using pg_restore.exe

When I try to execute pg_restore.exe of a dump file from a database, it throws dozens of errors, all the same: ERROR: insert or update on table "someTable" violates foreign key constraint ...