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
1answer
788 views

Using pgsql_fdw in a function result “ERROR: cache lookup failed for type 0”

Now we want to use pgsql_fdw to select a table of remote postgresql database,When we select the table in a session it is okey ,but when we use the foreign table in a funciton it turns out "ERROR: ...
5
votes
2answers
7k views

Easy Postgresql master/slave replication with automatic failover on Linux?

I need a reliable SQL DB for our application and have been looking at Postgresql's streaming replication support. It seems that it's not hard to setup master/slave replication and you can use the ...
1
vote
1answer
144 views

PostgreSQL Replication for small, low-usage database

I have PostgreSQL 8.4 installed on a headless Ubuntu 10.04 server. Sometimes the server is not available. I would like to continue working on the database, so I thought of installing PostgreSQL onto ...
2
votes
2answers
3k views

Trouble recovering data from corrupted PostgreSQL tables

I'm trying to recover my database after a recent corruption of the same. Now I have two tables that are really giving me trouble. When I do select count(*) One table returns: ERROR: could not ...
2
votes
2answers
288 views

Attacks on Postgresql listening for requests on 'localhost'

I am using jboss server for my servlets and the postgresql as the database server, listening on port 5432 on localhost. My jboss server is bound to a public IP. I want to know that since my postgesql ...
1
vote
1answer
2k views

Really slow DISTINCT ON query with multiple joins

Originally posted: http://stackoverflow.com/questions/11173717/expensive-query-on-select-distinct-with-multiple-inner-join-in-postgres The songs table has only about 4k rows, posts and stations have ...
3
votes
2answers
2k views

Postgres primary key sorted in the reverse order. Will it use the index efficiently?

My Rails database is backed by Postgres database. As you may know, each table in Rails gets assigned a primary key which is of Integer type and is indexed. My list views show records in the reverse ...
2
votes
1answer
1k views

Syncing two (or more) PostgreSQL 9.1 clusters

This question assumes the use of PostgreSQL 9.1. Say I have two PostgreSQL database clusters. Each cluster contains three PostgreSQL servers. A master, a slave synced via synchronous replication and ...
1
vote
1answer
572 views

Search for null in id column over all tables programmatically

I want to automatically check for null ID's over all id columns in my database, I have to check all tables of which there is about 50,000 so manually doing this is infeasible
5
votes
2answers
1k views

Slow ORDER BY with LIMIT

I have this query: SELECT * FROM location WHERE to_tsvector('simple',unaccent2("city")) @@ to_tsquery('simple',unaccent2('wroclaw')) order by displaycount I'm happy with it: "Sort ...
1
vote
1answer
291 views

PG_bulkload utility postgresql need help

i am using COPY command to export the data to the out file with changes made to the data before export using option ST_asBinary() using command COPY ( SELECT st_asBinary(geom) FROM n_america ) TO ...
0
votes
1answer
940 views

Unable to reset the password of users in postgres

Evrytime i run, su - postgres it asks me for a password which I did not set. I simply installed the postgres. I have gone to the pg_hba.conf. # Database administrative login by Unix domain socket ...
6
votes
1answer
6k views

How to set Postgresql database to see date as “MDY” permanently

Ho can I set my database to see the 'date' as "MDY" without running: SET datestyle = "ISO, MDY"; every-time I'm trying to access it? I'm using Postgresql version 9.1, Ubuntu 12.04. My system ...
8
votes
1answer
30k views

How do I reset the postgres password for PostgreSQL on Windows?

I have installed PostgreSQL on my Windows machine for development. Now I haven't used it for a while, and have forgotten the password for user postgres (default admin user in PostgreSQL). How can I ...
3
votes
2answers
4k views

How to create column in DB with default value random string

Can I create column in DB table (PostgreSQL) which have default value random string, and how ? If is not possible, please let me know that.
0
votes
1answer
192 views

What database do most mobile start ups use? [closed]

mongodb? MySQL? PostgreSQL? If someone would add pluses and minus, let me know. Why I ask: I am a mobile startup. I need a database that supports spatial indexes. The spatial index must be able to ...
3
votes
2answers
8k views

How do I copy databases from Postgres 8.4 to Postgres 9.1?

My trac server recently started having issues. It was running a very outdated version of Ubuntu, and I was unable to properly use apt-get to correct the issues I was having. So instead I backed up the ...
2
votes
3answers
6k views

Starting postgresql service and specifying data directory

I have recently installed pg 8.4 on Ubuntu 10.0.4 using apt-get install. It installed pg as a service which starts ehenever the machine starts. However I have created a db cluster in a specific ...
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 ...
4
votes
1answer
573 views

timelines and history files PostgreSQL 9.1

What is the purpose of timelines, history files, and the setting 'recovery_target_timeline' in recovery.conf? The vague understanding I have from the PostgreSQL 9.1 documentation is when the slave ...
1
vote
2answers
192 views

Perf of query of large table by date?

I have a table with some sensor data in it which grows every minute with a new measurement for that specific sensor. Something like: entry_id (pk), sensor_id (fk), measurement_value, created_at I ...
5
votes
1answer
350 views

Database Exceptions with Jetty 8.1.0 with BTM

We are running Jetty 8.1.0 with BTM 2.1.2. We are using Postgres as our DB. Everything works great except that when we run any query with a condition where sometable's primary=null, the server loses ...
2
votes
1answer
2k views

postgres composite index design

In my rails application using the Postgres database, I have a table called tw_schedules which belongs to a scenarios table (one scenario to many tw_schedules). In addition to the scenario_id foreign ...
4
votes
4answers
4k views

Passing arguments to psql

I'm running a plpgsql script in Postgres 8.3 - I would like to pass arguments to this script via psql. I'm currently executing the script like: psql -d database -u user -f update_file.sql I came ...
1
vote
1answer
378 views

What is the “Data partitioned, Shared-Nothing, Parallel Database” solution for PostgreSQL ? [closed]

I was looking for a open source parallel database solution. It seems Postgres-XC is a viable solution. However, I don't need the replication. In this case, is there any better solution towards read ...
3
votes
1answer
610 views

is my postgresql-server thread-safe?

before 9.0 i had to compile my postgresql-server with "--enable-thread-safety" for http://www.bacula.org since 9.0 the config-paramater is renamed to "--disable-thread-safety". The "PostgreSQL ...
0
votes
1answer
471 views

Can't get past password lock on fresh install of postgreSQL

I feel really dumb writing this, I wanted to have a mess around with databases so I just installed postgreSQL (9.1) During the installation I am asked to provide a superuser password. I provide a ...
3
votes
2answers
3k views

Freeing disk space after dropped database

I'm working on a dev system, and I have been restoring to a database, say "foo", that I'm using for dev purposes. As I'm working through the kinks, I've just been running DROP DATABASE foo. However, I ...
4
votes
2answers
2k views

Streaming Replication in PostgreSQL

I'm trying to set up two PostgreSQL servers on one machine and perform a streaming replication. I have succeeded once, but when i've tried again following exactly the same steps it doesn't work.. ...
3
votes
2answers
1k views

Do all users need access to the postgres database in pg_hba.conf?

I was just testing the user creation process in pgAdmin. I have a database db1 for which I want to create a user to be able to connect to it. I want this to be the only database the user can connect ...
4
votes
2answers
1k views

Importing LARGE quantity of data into a PostgreSQL database

I am importing a large amount of data into a PostgreSQL server (across multiple databases on the server). When I last attempted to import the data, it effectively "crashed" my machine (Ubuntu ...
10
votes
1answer
496 views

Disable explicit commits in JDBC, detect them in SQL, or put the database in a readonly state

Background: I'm working on http://sqlfiddle.com (my site), and am trying to prevent one avenue of abuse possible there. I'm hoping that by asking about a problem I'm currently addressing, I don't ...
1
vote
1answer
339 views

Slony initial subscription is causing out-of-memory kernel panics. Why?

Context: We run Slony 2.0 with Postgres 8.4 on two CentOS 6 servers--one master, and one slave. Our database is about 30GB in size, which isn't unusual, but we do have a couple of tables that are ...
8
votes
3answers
475 views

What is retrieved from disk during a query?

Fairly simple question, probably answered somewhere, but I can't seem to form the right search question for Google... Do the number of columns in a particular table affect the performance of a query, ...
2
votes
1answer
17k views

How to import a.csv file into a postgresql database using \copy?

I am trying to import a .csv file into a postgresql database. I am using pgadmin III for that on a win7 machine. My query looks like that: \COPY pop_grid(GRID_ID, POP_TOT, YEAR, METHD_CL, CNTR_CODE, ...
2
votes
2answers
277 views

speeding up a deletion in postgresql

I came up with: drop table if exists idtemp; create temp table idtemp as select documentid from taskflag where taskid='coref' and state = 2 order by statechanged asc limit howmany; ...
2
votes
3answers
613 views

Postgresql sync databases

I am having a postgres database on my portable and on a server. I would like to keep those two in sync as easy as possible. I know about slony but I am not able to figure out: Does it work when the ...
13
votes
1answer
27k views

How to connect to an remote PostgreSQL database on Ubuntu using pgAdmin3?

I´m trying to setup an PostgreSQL database on an Ubuntu machine. I would like to be able to access it using pgAdmin3 from a remote machine. How do I setup this? I have installed the PostgreSQL ...
15
votes
3answers
9k views

Are regular VACUUM ANALYZE stil recommended under 9.1?

I'm using PostgreSQL 9.1 on Ubuntu. Are scheduled VACUUM ANALYZE still recommended, or is autovacuum enough to take care of all needs? If the answer is "it depends", then: I have a largish database ...
3
votes
2answers
274 views

Migrating and normalizing data

We are rewriting a large Django application which uses a MySQL database, and the database schema needs to undergo major modifications. We're also porting the app to use PostgreSQL, for a couple of ...
0
votes
2answers
616 views

Creating a test database from Production database (different machines & servers)

I'd like to set up a test database on a separate server. Production database is MS SQL Server and the test server is a *nix box so I'd like to have the test server running either PostgreSQL or MySQL. ...
2
votes
1answer
4k views

how do I execute a void-returning procedure in pgsql 9.1?

If I execute the following in a file with the pgsql command, it complains that the procedure needs to be called with 'perform'. But when I try to use perform, it tells me that perform is not defined. ...
1
vote
1answer
176 views

using COPY command and wal_buffers

since COPY command runs inside a single transaction, if its WAL data doesn't fit into wal_buffers? for example if we are bulk importing from CSV file.
3
votes
1answer
1k views

Difference between fsync and synchronous_commit - postgresql

What is the difference between fsync and synchronous_commit? I read the documentation, the only thing I understood is both of them are trying to make updates physically written to disk.
3
votes
1answer
582 views

What happens when checkpoint_segments reached?

I'm a bit confused with checkpoint_segments definition in PostgreSQL documentation. What happens when checkpoint_segments reached? The dirty pages in shared_buffers written to WAL. Then what is the ...
9
votes
4answers
12k views

tuning postgresql for large amounts of ram

I have two identical servers (in terms of hardware), they are both standard installations of windows server 2008 r2, with minimal software installed (basically my code and required stuff like jvm ...
6
votes
2answers
4k views

Can I have one table be an “alias”, or “symlink”, to another?

I have two tables with the same structure, A and B. A certain application is written so that it always writes the same data to both tables. After a discussion with a colleague about the potential to ...
2
votes
0answers
36 views

Splitting a wide table [duplicate]

Possible Duplicate: Database Design: New Table versus New Columns I'm in the process of building a DB schema that contains information about something we call "blocks" (not very important ...
12
votes
3answers
1k views

Can spatial index help a “range - order by - limit” query

Asking this question, specifically for Postgres, as it has good supoort for R-tree/spatial indexes. We have the following table with a tree structure (Nested Set model) of words and their ...
3
votes
1answer
335 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, ...