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)

7
votes
1answer
6k views

MongoDB performance vs. PostgreSQL with 5.5 million rows / documents

Can someone help me compare these queries and explain why the PostgreSQL query executes in just under 2000ms and the MongoDB aggregate query takes almost 9000ms and sometimes as high as 130K ms? ...
2
votes
1answer
113 views

How to create Select query function in the Postgresql?

I want create select function in postgres and get all data from table. I many example see and try but not perfact execute function. What perfact syntax for select query function create in postgres? ...
1
vote
1answer
131 views

PostgreSQL's Query Hierarchical data poor performance

Badly need some technical assistance on this query performance issue I'm working on. Summary of the data structure is: 1 project has many homeprofiles, 1 homeprofile has many tasks, 1 task has many ...
1
vote
1answer
215 views

Postgres streaming replication to a different schema on another server?

We've got a system with about a dozen Postgres 9.3 databases representing a dozen different applications. In order to do reporting across systems, we have a script that dumps each database and loads ...
3
votes
1answer
123 views

postgres filtering select based on combination of joins

I am having trouble filtering a request that depends on a combination of child elements (one-to-many relationship) Please consider the following example. CREATE TABLE sample_container ( id serial ...
2
votes
1answer
805 views

Can't restore my distribution DB postgres 9.2 backup into my staging DB postgres 9.3

I keep getting this pg_restore: [archiver] did not find magic string in file header when i execute a pg_restore -Fc -U "username" -d "dbname" "filename".dmpon my staging DB. These DB are running on ...
0
votes
1answer
155 views

Issues with 'plus symbol' output in PSQL on update query

Simple but frustrating issue... I'm trying to do an update command to correct a misspelling with this field: grouper=> select * from master_list WHERE group ~ 'JustAdopted'; group | ...
0
votes
1answer
402 views

Postgres pgpool increase num_init_children

I am trying to tune postgre to allow many concurrent queries from clients as i am checking how many parallel connections with there queries it can handle. I read A good PgPool II configurataion , ...
0
votes
2answers
234 views

How to list all table columns in sorted order?

I know that \d table_name lists all columns for that table, but is there a way to list them sorted in alphabetical order?
0
votes
0answers
2k views

Postgres FATAL: could not open relation mapping file

I installed postgress.app on mac os when I try to connect to console : psql -h localhost I got this problem . psql -h localhost psql: FATAL: could not open relation mapping file ...
0
votes
0answers
219 views

Can't connect to local Postgres databases

After trying to install Postgres using Postgres.app and EnterpriseDB, I decided to re-install it using Homebrew (As I got some problems connecting to database). PYTHON=/usr/local/bin/python brew ...
0
votes
2answers
405 views

How do I use an Ispell dictionary with Postgres text search?

Postgres can use Ispell-compatible dictionaries in text search, but does not provide the required files.
0
votes
1answer
60 views

What configuration to use for PGbouncer over a WAN link

We have two datacenters, one in America and one in Europe. For various reasons, the Europe datacenter has the database server, while the workers and web apps are in America. PGbouncer is in the ...
0
votes
1answer
59 views

Postgresql Write Only Primary Server Bottleneck for Streaming Replication

I'm wondering about whether CPU/RAM plays an important role for the primary server for a Postgresql Streaming Replication setup where you have one primary server that receives all the write operations ...
0
votes
2answers
382 views

Can't run PostgreSQL locally

I am working to run PostgreSQL is running locally but I cannot connect. I installed postgress using brew, then I downloaded http://postgresapp.com When I try to create a database createdb: ...
2
votes
2answers
64 views

Postgres CREATE DATABASE already has data and tables

When I do a: DROP DATABASE mydb; and subsequently: CREATE DATABASE mydb WITH OWNER user; the new mydb database is created with all the tables and data that I had in the database I just dropped. What ...
0
votes
0answers
219 views

How to copy PostgresSQL database from remote server to LOCAL PC WITHOUT PG_DUMP(ALL)?

How to copy PostgresSQL database from remote server to local PC without pg_dump (or pg_dumpall ? Any format is good (plain text,sql,csv..) I have NO root access to remote PostgresSql database and I ...
1
vote
1answer
91 views

PostgreSQL - Create view with autoincremental column

I have a PostgreSQL table, and I need to create a view with a new column. This column needs to be an auto-incremental column starting at 1 and going to N. Is this possible to do without effecting the ...
0
votes
1answer
78 views

Postgresql Logging Questions

I'm seeking some help understanding my PostgreSQL 9.3 log file. (Note: maybe this should be multiple questions, they are all involve the same general topic - which is understanding my log file). In ...
0
votes
0answers
211 views

What size of data can PostgreSQL handle?

We wanted to use OpenERP along with PostgreSQL database. OpenERP has a functionality to upload documents and stored in to database in binary format. Our worry is if user decides to upload to huge ...
0
votes
1answer
2k views

Trying to restore a corrupt Postgresql database, with corrupt data folder. Able to start postgres but the tables are empty?

Postgres 9.3 on Ubuntu 12.04 We had some disk corruption on our server, and after doing a fsck the database would not start. To get us back into production, I copied the postgres data folder, blew ...
3
votes
1answer
973 views

Can I provide a default for a left outer join?

Suppose I have tables a (with column a1) and b (with columns b1 and b2) and I perform a left outer join SELECT * FROM a LEFT OUTER JOIN b ON a.a1 = b.b1 Then b1 and b2 will be NULL where a value of ...
0
votes
2answers
128 views

Postgres 9.2 - Create View Different Column Names

I want to create a view of a table with a column renamed. I do not want to effect the source table, just the view. I need to rename the column addr:housename to addr_housename. We have a 3rd party ...
1
vote
1answer
105 views

Appending imported data in Postgres

This is what I typically use to import csv data into my postgres database.. \COPY master_list FROM '/root/raw/file.txt' DELIMITER ',' CSV; Usually it's into a blank table, but in this case, I need ...
0
votes
1answer
301 views

Sync offline PostgreSQL server

I am new to PostgreSQL. I am looking for a solution wherein 2 mirror images of a database sit on a local and remote server. All the work is done on the local server and at periodically synced with the ...
0
votes
1answer
226 views

Taking hot backup of slave node in postgres (master-slave config with repmgr)

I have a postgresql setup with master-slave configuration using repmgr. I'm struggling with taking a consistent snapshot backup (pg_start_backup) of the slave node, this is due the fact that the slave ...
3
votes
1answer
173 views

PostgreSQL: When should I use fillfactor < 100 for tables on SSD?

PostgreSQL documentation says that choosing smaller fillfactor lets table reserve space for future updates on the same page and "This gives UPDATE a chance to place the updated copy of a row on ...
1
vote
3answers
111 views

How to map similar camelcased, pascalcased, underscored, lowerscored words to the same id?

I'm working on PostgreSQL and I have a table like this called words_table: I need all equivalent words (like software_design and software-design) to have its map value = to its word's equivalent ...
2
votes
1answer
41 views

General purpose view for last value in a group

I am trying to create a view to show the last value in the group. Looking for a more general purpose query. CREATE TABLE a ( id INTEGER, seq INTEGER, val VARCHAR2(16), PRIMARY ...
1
vote
3answers
3k views

Select query to retrieve values even if are null

I need some help in a query. Need to retrieve data from 1 table, even if one of the field has null value. Here's an example: Select name, SUM(credit) as credit From expenses Where name like ...
3
votes
1answer
166 views

Determine the currently executing statement in a long running PL/pgSQL stored procedure

I have a long running PL/pgSQL stored procedure in PostgreSQL. How can I determine the currently executing statement in it?
0
votes
1answer
243 views

Importing data from MS Access database to an existing Postgres database

I'm developing a Django based website with a Postgres DB. The problem I'm having is importing the data from an Access DB into it. To be specific, I'm not trying to translate/import the schema from ...
5
votes
1answer
1k views

How to reclaim disk space on PostgreSQL?

I have local installation of 9.1 database with few tables which had cca. 300 mio records and the database grew to about 20 GB. Afterwards I issued delete from command to delete all records from it (I ...
0
votes
1answer
826 views

PostgreSQL user permissions

I have a PostgreSQL 9.3 database with the PostGIS extension backing a web application and GeoServer. I have created three users. A read only user for accessing the data in the reference data schema. ...
3
votes
1answer
3k views

PostgreSQL High Availability/Scalability using HAProxy and PGBouncer

I have multiple PostgreSQL servers for a web application. Typically one master and multiple slaves in hot standby mode (asynchronous streaming replication). I use PGBouncer for connection pooling: ...
0
votes
3answers
81 views

Postgresql: Make Column Default a Query

Is there a way I can set up a column in PostGreSQL 9.2 such that the default value is a query? I am having to track down query statements from different sources that don't respect the "default" ...
0
votes
0answers
345 views

Postgres Backup on linux server [closed]

I am trying to take backup of postgres from InstallAnyWhere which is installer for linux and windows machine. I am calling pg_dump from Java process builder as command line below cmdLine: ...
0
votes
2answers
83 views

Does Postgres support stored column labels that can be queried?

I'm not a DBA but seem to recall that there was a SQL database that stored column labels (preferred column headings that can be printed on reports). Does Postgres support labels such as these?
5
votes
1answer
361 views

Fastest way to get current user's OID in Postgres?

I am thinking of storing the user's OID in the "owner" column of a table, so I don't have to do anything if they change their username. I understand one can use pg_has_role() with OIDs, so that's ...
0
votes
0answers
132 views

postgres pgpool2 replicating fails in ubuntu 12.04

I'm trying to configure a pgpool2 loadbalancer (in a Ubuntu 12.04 server) to balance between 2 postgres nodes (2 ubuntu 12.04 servers). The main problem is that, if I create a database using pgAdmin ...
4
votes
3answers
1k views

VACUUM FREEZE vs. VACUUM FULL

Can someone explain the difference between these types of VACUUM in PostgreSQL? I read the doc but it just says that FULL locks the tables and FREEZE "freezes" the tuples. I think that's the same. Am ...
0
votes
2answers
569 views

PostgreSQL - pgAdmin error creating a server

I have the latest versions of PostgreSQL and its GUI-frontend, pgAdmin, installed. When I try to register a new server a fatal error appears when pgAdmin tries to connect to the newly created server - ...
4
votes
0answers
195 views

Replace a materialized view in Postgres

I have a materialized view in Postgres 9.3 that I'd like to update with new columns. Other materialized views also depend upon this view, but the error message indicates that dropping a view isn't ...
0
votes
1answer
160 views

Problems using “Excel PostgreSQL Import, Export & Convert Software”

I want to export data from Postgresql, and I tried many ways then find the tutorial of Excel PostgreSQL Import, Export & Convert Software on Youtube. I installed the software, but I could not ...
7
votes
2answers
838 views

Migrate heroku database to Amazon RDS with minimum downtime

I have a heroku postgres database and want to migrate it to Amazon RDS to save cost. What's a way to do so with minimum downtime? Usually this involves replicating database in real time and then ...
0
votes
1answer
427 views

PostgreSQL FTS and Trigram-similarity Query Optimization

I have recently started working on PostgreSQL and I have around 12M rows to handle in which I want to apply Full Text Search. I don't have any prior experience in handling such databases. I have tried ...
0
votes
0answers
599 views

hstore vs redis performance wise (without durability) [closed]

How do PostgreSQL's Hstore and Redis compare performance-wise? This question was asked here, but I would like to compare with a PostgreSQL configuration without durability guarantee, i.e. with ...
1
vote
2answers
91 views

Vacuuming database termination for postgreSQL

I was doing database vacuuming to free up disk space for postgreSQL database. The corresponding table size was large and it was taking long time for vacuuming to get complete. But unfortunately ...
0
votes
1answer
216 views

How to copy the postgresql's xlog files safely

I mean how to safely copy xlog files when postgresql is running? Any reply will be appreciated.
0
votes
0answers
44 views

Need to calculate replication lag in postgresql 9.0 in terms of time

How to calculate replication lag on Postgresql 9.0 in terms of time(seconds). Presently we are calculating the lag by subtracting Time of latest checkpoint from system time. But that does not give the ...