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)

1
vote
1answer
14 views

Migrating from PostgreSQL to SQL Server

I have been tasked to migrate a database from PostgreSQL 9 to SQL Server 2008 R2, and I have found some issues I need to address. I have quite limited experiences with PostgreSQL I'm afraid. Most ...
5
votes
1answer
59 views

ANALYZE strategy for big tables in PostgreSQL

In our PostgreSQL 9.4.4 database we have a table that receives around 600k new records each day. Each day, nightly, we are performing some ETL exports from the table. If it has not been analyzed ...
2
votes
1answer
201 views

Postgres query plans and tuning parameters

I have a query for which the explain plan indicates that the cost for using a seq scan is lower than the cost for using an index that I have set up. However the actual time for the query is 20 times ...
3
votes
1answer
18 views
3
votes
2answers
44 views

Conditional Foreign Key Relationship

I currently have a foreign key between two entities, and I would like to make that relation conditional to the entityType of one of the tables. Here's the hierachy of tables, this is done via FK ...
2
votes
1answer
2k views

PgPool 2 with HA Proxy

So, I'm looking to add high availability to a postgresql server. I've looked into some tutorials on the web but, haven't been able to find exactly what I'm looking for. E.g.: PostgreSQL ...
3
votes
0answers
2k views

How to properly monitor the number of PostgreSQL database connections?

I tried to use a Nagios script for monitoring the number of database connections on a Postgres database and I reached this problem: these are counted as currently open-connections and measured every 5 ...
1
vote
1answer
15 views

GIN index not used when adding order clause

I'm trying to speed up a query that executes three ILIKE queries and reduces these with or (returning the overall count and 10 entries) SELECT *, count(*) OVER() as filtered_count FROM "users" ...
0
votes
1answer
10 views

Copy postgis layer from S3 to Heroku

I have a dump of a postgis layer (layer.dump), which I am trying to add to my heroku database (mydatabase). The postgis layer is stored on S3 (https://s3.amazonaws.com/layer.dump). I would like to add ...
6
votes
1answer
5k 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: ...
1
vote
0answers
10 views

MATLAB® export double numbers into PostgreSQL by `datainsert` (of Database Toolbox)

How is it possible to pass double numers into numeric postgreSQL columns from MATLAB? Here the list of matlab data: var1 197x1 cell var2 197x1 double var3 197x2 double var4 197x2 double ...
1
vote
0answers
4 views

Generate tables from entities with hibernate

I'm using postgresql with a spring/hibernate to create a multi-tenant application where every company will have its own seperate schema and tables in the database. So when the super administrator ...
2
votes
0answers
10 views

Slow fulltext search for terms with high occurence

I have a table that contains data that is extracted from text documents. The data is stored in a column called CONTENT for which I have created this index using GIN: CREATE INDEX "File_contentIndex" ...
0
votes
0answers
12 views

postGIS dump size seems strange

I have this table on postGIS 2.1.5 (postgres 9.4.3). A pg_relation_size shows a size of 300MB. However when I try to dump the schema containing this table (and only this table), I end up with a 27GB ...
1
vote
3answers
61 views

Create database design with requirement

I has a small database structure with an Account and Person. I want apply the following requirement: Account have one Person Person do not have necessarily one Account (can be null) When I delete ...
0
votes
1answer
124 views

Restoring a database using Postgres data files instead of .sql files

I backed up my Ubuntu 14.04 system using rsync to a USB stick, but apparently it wasn't formatted for booting. The original disk has been erased and I put a fresh install of Ubuntu on it. In migrating ...
1
vote
0answers
34 views

3 tables joins performance issue

DB: Postgres 9.4 schema: table a: id, score table ab: a_id, b_id, b_type table b: id, name, type I am trying to get top 10 result in the following format: name, count(group by name), ...
0
votes
2answers
152 views

Lower() vs ilike on postgresql

What I want to do is to check if value of column equals some string, but case insensitive. Is there a performance difference when using ilike without wildcards (percents) and lower() ? I was planning ...
1
vote
1answer
32 views

PostgreSQL, how to extract all the possible couples of a primary key in a table?

I would like to find out a PostgreSQL command that reads the content of a table, and returns all the possible couplings of the primary key of the table. Something like this: input_table (ID is the ...
3
votes
2answers
76 views

Extremely slow query on indexed column

I'm getting a extremely slow query on an indexed column. Given the query SELECT * FROM orders WHERE shop_id = 3828 ORDER BY updated_at desc LIMIT 1 explain analyze returned: QUERY PLAN ...
3
votes
1answer
47 views

GROUP BY uninterrupted sequence of logs for same location

I'm having a hard time describing my problem or finding it via Google. I want to be able to group rows based on location and employee, but the group should be split if a row with the same location ...
0
votes
1answer
118 views

Postgresql Chained Slaves and Slave Promotion

So I have a setup like Master -> Slave1 -> Slave2. Slave1 replicates from Master and Slave2 replicates from Slave1. If I promote Slave1 to master is it possible for Slave2 to continue replicating from ...
2
votes
1answer
152 views

How to keep the sync active with Bucardo

I have a master-master sync setup between 3 nodes or 3 different host machines using bucardo. All works good. However when one of the database or a host is not reachable or goes down for some reason, ...
1
vote
0answers
20 views

Postgresql FDW oracle out of memory

I have a linux box with centos 6.7 and postgres 9.3.9. I have a foreign data wrapper throught an oracle 11.2 box and a jdbc driver. It's working fine since several months, but yesterday I had to ...
1
vote
1answer
38 views

Can I do VACUUM FULL to pg_largeobject table?

I have two tables (table1, table2) in a Postgres 9.1 database. Both having oid type. Each table 1 million records. And pg_largeobject table size is around 40GB. I have removed 0.9 million records from ...
0
votes
0answers
15 views

RDS raising unwanted PostGIS NOTICEs

I have an Amazon RDS instance that is producing unwanted NOTICEs. I have never seen this behaviour before. mydb=> select current_setting('client_min_messages'); current_setting ...
-3
votes
1answer
188 views

No operator matches the given name and argument type(s). You might need to add explicit type casts [closed]

postgres=# select * from json_test; id | data ----+----------------------------------- 1 | {} 2 | {"a": 1} 3 | {"a": 2, "b":["C", "d"]} 4 | { "a":1, ...
2
votes
1answer
80 views

Postgres Count with different condition on the same query

EDIT Postgres 9.3 I'm working on a report which has this following schema: http://sqlfiddle.com/#!15/fd104/2 The current query is working fine which looks like this: Basically it is a 3 table ...
0
votes
1answer
417 views

Pros and cons of using many schemas in PostgreSQL as opposed to just one?

For a large SAAS application (backed by PostgreSql 9.4), with over 300,000 accounts (and growing), what are the pros and cons of using a schema per account to partition the data vs putting all the ...
0
votes
0answers
8 views

Multiple Tables as source and Target in Talend Open Studio

Loading data from mysql to postgres through Talend is working for single table loading. How to load whole db loading(multiple tables). can anyone tell me?
0
votes
2answers
31 views

Can I make postgres more verbosely tell me what it's doing?

I'm trying to use ALTER TABLE on a live db (not in production, just poking around at a dev box and trying to learn some things) Here is the command I'm trying: psql -h $IP -p 5432 -U $DBUSER -d ...
1
vote
0answers
20 views

Connection Failure for postgres at Talend Open Studio

I have tried to connect postgresql database in Talend open studio. After giving login, password, port and server, i have issued check. Its saying "Connection Failure. You must change the DB Setting". ...
0
votes
0answers
13 views

Deleted data from pg_authid

This is my first post on this site. I've recently by mistake deleted all data from pg_authid. As a result i couldn't log into database cluster (no user 'postgres'). I've managed to restore database ...
1
vote
0answers
7 views

postgresql: deleting from a view

In Postgresql 9.4, we're doing a view as a UNION of to tables A and B, and we'd like to have a single DELETED N ROWS message when we 'delete' the records in the underlying tables (via a a trigger on ...
3
votes
1answer
29 views

PostgreSQL table partitioning problem

I partitioned my table day by day. The child tables are look like points_20150830. Every day, I run a cron job to create table and I insert records without using any trigger function. I insert ...
0
votes
1answer
17 views

Restore Postgres Database on New Machine

Trying to restore a postgres database on a new Macbook Pro. I recreated the database using createdb dbname then tried to restore the old database using psql dbname < dbname_dump.bin but ended up ...
2
votes
1answer
61 views

Trigger function using current row and current table name as variables (final part)

Like detailed in my first question I have a Postgres 9.1 database with multiple tables that have the exact same column names, they only vary in their column values: tbl_log_a tbl_log_b tbl_log_c ... ...
0
votes
1answer
167 views

Postgres Partition Table Trigger inserting duplicate records

I have a trigger applied on my database table. But when i insert data into it via hibernate jpa it creates duplicate rows in master table. Here is the trigger CREATE OR REPLACE FUNCTION ...
2
votes
1answer
128 views

“ERROR:malformed array literal” when using json_to_record with a JSON array element in Postgres 9.4

This illustrates the issue nicely: When column b is of type text, and not an array, the following works: select * from json_to_record('{"a":1,"b":["hello", "There"],"c":"bar"}') as x(a int, b ...
3
votes
1answer
39 views

Is it safe to use set-returning sql functions instead of security-barrier views?

Since 9.2, it's been possible to use the security_barrier attribute to guard against maliciously-chosen functions and operators accessing data 'hidden' behind filters in views (full info in the ...
0
votes
1answer
43 views

PostgreSQL failed on Select

I am trying to use a result from a select for another select: DECLARE _port int; BEGIN select alter_port into _port from database where ....; select data inot data_list from database where ...
1
vote
2answers
147 views

Limiting read access in postgres to few rows

We have a requirement where we want to limit the maximum no. of rows that a select query can return when its done using a particular login. So basically we would like to append a limit clause to any ...
2
votes
1answer
219 views

How to create Postgres DB with case insensitive collation

I am using the postgres version 9.4.1 64-bit on windows 7 64-bit. I need to create DB with the setting "case sensitive = OFF" but couldn't make this work. I refereed already many question on SO and ...
4
votes
2answers
18 views

Improve performance for order by with columns from many tables

Using PostgreSQL 8.4, I'm trying to consult two tables with 1 million records using order by with indexed columns of the two tables, and I'm losing performance (with 1 column takes 30 ms and with two ...
2
votes
1answer
33 views

Distributing a semi-large key/value list

I have a semi-large (around 30 million records) key/value list which I want to load into redis. The data is stored in PostgreSQL (as master data) and we want to distribute this to clients for faster ...
1
vote
1answer
45 views

What kind of database should I use?

I'm designing a new system and I'm wondering what kind of DB should I use for my needs. I have a tree structure of nodes, where each node has historic values. For each historic value it should hold 2 ...
2
votes
1answer
217 views

PostgreSQL server problem in Windows XP

2014-10-01 09:22:49 IST LOG: database system was interrupted; last known up at 2014-09-30 18:30:24 IST 2014-10-01 09:22:49 IST FATAL: the database system is starting up 2014-10-01 09:22:49 IST LOG: ...
4
votes
1answer
66 views

Why is a gin index on a jsonb column slowing down my query and what I can do about it?

Initialize test data: CREATE EXTENSION IF NOT EXISTS pgcrypto; CREATE TABLE docs (data JSONB NOT NULL DEFAULT '{}'); -- generate 200k documents, ~half with type: "type1" and another half with type: ...
1
vote
0answers
22 views

Postgres 9.4 on kubuntu 14.04 won't start

I've had postgres9.4 running without incident for around 5 months. Today after a restart I can't get postgres running. When I open pgAdminIII and try to connect to my server I get "Server doesn't ...
1
vote
1answer
676 views

Tree structure hierarchical query sorting

I have the following structure of table. CREATE TABLE table1 ( serial_num integer NOT NULL, parent_num integer, parent_key text, key_ary_num integer[], level integer, rank integer, ...