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

Prevent postgres function of running more than 1 instance at the same time

DBMS: Postgres 9.3.4 OS: Debian 7 I have a plpgsql function that will be put in crontab to run every 15 minutes. The function should finish in about 8 minutes, but just in case it takes more than 15 ...
1
vote
0answers
26 views

Selecting aggregated string from database

I have a table in my database consisting of one column which is NewLanguage(varchar). I insert new languages to the table and I want to select the rows of the table and assign them to a string ...
2
votes
0answers
66 views

Fast hamming distance queries in postgres

I have a large database (16M rows) containing perceptual hashes of images. I'd like to be able to search for rows by hamming distance in a reasonable timeframe. Currently, as far as I properly ...
3
votes
2answers
113 views

How to avoid the SORT operation in SQL query that contains ORDER_BY condition?

I am optimising a PostgreSQL query which involves three tables and a ORDER_BY condition. It seems that PostgreSQL prefer to arrange a SORT operation to perform the ORDER_BY condition, rather than ...
0
votes
0answers
33 views

Using PGBouncer with HAProxy results in connection errors only after load testing

We have a website (flask python based) which is load balanced between to instances. This two clients have both their own pgbouncer master which connects to a single HAProxy which is round robin ...
2
votes
2answers
107 views

Conditionally sum a column based on a mod result [closed]

I have the following query: SELECT y.datamov, y.n_conta, y.sinal, y.valor, y.qtde, a.nome, '', 0, a.lrdarc FROM ( SELECT k.datamov, ...
3
votes
2answers
85 views

How to inner join some tables and outer join others?

I'm certain I'm going to be embarrassed by the eventual answer, but I've been googling around and banging my head against the wall and can't figure it out. I have four tables described below. I'm ...
3
votes
1answer
86 views

duplicate key violates unique constraint when using multi-threading

I am using ExecutorService with a fixed thread pool of 50, and a fixed database connection pool of 50, using HikariCP. Each worker thread processes a packet (a "report"), checks if it is valid (where ...
3
votes
1answer
70 views

Very large btree index with few rows (openstreetmap gis data)

I tried to import a subset of open street map data to a Postgres database using the standard tool (osm2pgsql). I then tried to rebuild the indices on the table using plain sql (dropping them, then ...
1
vote
1answer
27 views

Explain PostgreSql ssl_cipher values: ALL:!ADH:!LOW:!EXP:!MD5:@STRENGTH

In the postgresql.conf file, one can configure authorized values for ssl_cipher. Yet I could not find documentation explaining what the ALL, ADH, LOW, EXP, MD5 and STRENGTH values correspond to. MD5 ...
0
votes
1answer
26 views

PostgreSQL: How to list the comments attached to a database

How do I display the comments associated with a database, not a table? I've tried \dd and \list , but can't seem to find this. Thanks,
0
votes
0answers
30 views

What's causing Postgres to freeze?

I'm using Amazon RDS to run my Postgres database, v9.3.3. Recently, I had 2 instances where updating the schema caused the database to stop responding and I had to restart it in order to put the site ...
0
votes
0answers
8 views

Problems with PostgreSQL and ESRI Geoportal Installation on CentOS

I am installing geoportal 1.2.4 on CentOS from the command line terminal...during my installation I am receiving a fatal ident error message for my user geoportal. The pg_hba.conf file has been ...
0
votes
1answer
23 views

PostgreSQL, PostGIS: Copying a schema with a geometry column

According to the PostGIS manual, geometry columns should not by added directly, but using AddGeometryColumn(): AddGeometryColumn — Adds a geometry column to an existing table of attributes. I ...
1
vote
2answers
40 views

PostgreSQL/ Linux, way to have DNS forward to a port/cluster?

Aws linux(centos) ec2 Host: mydb. 10.10.10.10. 3 clusters: ports 5432, 5433, 5434 What I'd like to see is: db2.mydb or mydb/db2 connect/fwd to cluster2 (5433). Anything Linux or psql come to mind? ...
1
vote
2answers
66 views

Primary key with randomly varying increments (so it cannot be guessed easily)

I would like the primary keys to be auto-incremented and generated but in varying increments. For ex, if I have increment range as 100... then the auto generated keys would be something like below: - ...
0
votes
1answer
39 views

Postgres 9.3 changes the standard_conforming_strings value

I'm migrating a legacy application's database from Postgres 8.1 to Postgres 9.3 In order to avoid compatibility issues, I'd like to keep the standard_conforming_strings parameter to it's default ...
0
votes
1answer
33 views

Demo DB for book on PostgreSQL

The book PostgreSQL: Introduction and Concepts, printed in 2000, was highly recommended to me by the regulars in PostgreSQL IRC channel. However - I was trying to figure out which demo database ...
1
vote
1answer
46 views

Postgresql: set default psql client encoding

When I connect to a Postgresql DB using psql, I often get these messages: => SELECT * FROM question_view ; ERROR: character with byte sequence 0xd7 0x9e in encoding "UTF8" has no equivalent in ...
0
votes
1answer
30 views

Mixed search in multiple columns

I have a table which has a particular column of type JSON, where some user's contact information are stored. I can alter the table and add new columns with cached values to increase search performance ...
1
vote
0answers
61 views

Where Can I find *Current* PostgreSQL advice for a SQL Server DBA? [closed]

Been a MSSQL DBA for about 7 years. I have the fundamentals of performance, backups, replication, security and design down for MSSQL. I'm not setting up new applications using PostgreSQL 9.2. I have ...
1
vote
0answers
32 views

Strategy for multiple distinct databases in PostgreSQL

I have a 30 gb db in PostgreSQL 9.2. Running On Amazon Linux on an ec2 (web virtual machine), with the data directory mounted from its own drive (EBS). I'll call the database db30. On production ...
1
vote
1answer
44 views

Split two rows into two columns

I have the following table: id | name | action | count ------------------------------ 1 | Value1 | 0 | 27 1 | Value1 | 1 | 49 2 | Value2 | 0 | 7 2 | Value2 | 1 | ...
2
votes
0answers
94 views

Index for finding an element in a JSON Array in PostgreSQL (with multiple JSON fields)

Original question of what this is based on: http://stackoverflow.com/questions/18404055/index-for-finding-an-element-in-a-json-array This works fine if you only want simple matches. Suppose tracks ...
2
votes
1answer
28 views

Explicitly granting permissions to update the sequence for a serial column necessary?

Recently I did create a table as a superuser including a serial id column, e.g., create table my_table ( id serial primary key, data integer ); As I wanted my non-superuser user to have ...
0
votes
1answer
98 views

Streaming replication Postgresql 9.3 using two different servers

Settings in master server: max_wal_senders = 1 wal_level = 'archive' archive_mode = on archive_command = 'cd .' wal_keep_segments = 10000 Settings in slave server: in recovery.conf file: ...
0
votes
0answers
38 views

On Heroku in production, how can I copy database A to database B on command?

From my local terminal, I can use the following commands to do what I need to do: heroku pgbackups:capture --expire heroku pgbackups:restore charcoal --confirm max-kiosk However, I want to do this ...
1
vote
1answer
43 views

Postgresql pgAdmin, count(*), max(pk_field) giving inconsistent results

I am running postgresql 9.3.4 on a Centos 6.5 server as a back end for a web app which I am currently load testing. Presently, if I visit the state table in pgAdmin, right click on "count", I get a ...
1
vote
2answers
95 views

How to make a table name an attribute in PostgreSQL?

I have received hundreds of tables in PostgreSQL with identical structure and each containing similar data of a different day, so that the table name is the date of the data. I would like to Union ...
2
votes
1answer
208 views

How to pass a parameter into a function

At the moment I have a view created, see it here in the answer. How can I create a function on that cross tab, so I can pass a date, and get data for the specific date? Also is it a good practice to ...
2
votes
1answer
82 views

Promotion of PostgreSQL standby and application reconnection

Background: I work for a small company. We have been using PostgreSQL on Heroku as one of our core technologies. While, in general, we've been happy with Heroku, the company has made the decision ...
1
vote
2answers
58 views

Connect to PgAdmin III via localhost

I just want to login for first time, from pgAdmin III via localhost on openSuSE 13.1 64x. My pg_hba.conf: # TYPE DATABASE USER ADDRESS METHOD # "local" is for ...
0
votes
0answers
17 views

How to configure phpgdadmin?

I have some problems configuring phppgadmin. Initially I loaded phppgadmin over EnterpriseDB stackbuilder and it worked fine. After upgrading my OSX from OS 10.6.8 to 10.8.5 phppgadmin didnt respond. ...
0
votes
0answers
32 views

How to configure pgmodeler?

I am having some troubles configuring pgmodeler, particularly the Connections. I put Connection DB: postgres Host/Port localhost 5432 User postgres ...
1
vote
1answer
48 views

Statistical probability of an incomplete transaction committed by Postgres

tldr After spending time with bad databases which I will not mention, I came to question even the point of a database. I knew that they could serve a purpose to keep permanent data organized, but ...
3
votes
2answers
120 views

Are ORDER BY clause & ROW_NUMBER duplicating functionality when I need top n queries

I have a table that tracks violations for a student. I want to count the number of violations and select top 2 violators from each class. The query would look like this SELECT * FROM ( SELECT ...
1
vote
1answer
55 views

Update new column with value from old columns for all the rows

I've got an odd db design in place that was here when I got on my new work space. We have a column named params which contains some string data which appears that it belongs in more than one column, ...
4
votes
1answer
133 views

Pull data from multiple tables in a view or function

There are 3 tables from which I need to pull data, and print it in a specific way. http://sqlfiddle.com/#!15/59481/8 You can refer to this question to see how the query was produced. In the fiddle ...
1
vote
1answer
44 views

Wildcard subnet mask for IPv6

To allow any host to connect to PostgreSQL we can use the IPv4 wildcard subnet mask: 0.0.0.0/0 I need this to setup my PostgreSQL's pg_hba.conf file correctly. What is the IPv6 equivalent?
1
vote
3answers
51 views

How to log DML statements executed by a pl/pgsql function?

I have a pl/pgsql function (see below) that lists some fields and clears their contents using dynamically constructed UPDATE commands. When I set log_statement = 'mod', I can see nothing on the log ...
1
vote
2answers
35 views

Is there a way I can use currval() without selecting it more than once?

I want to be able to use the current value of an auto ID by giving it some kind of name and just referring to it (instead of calling SELECT for each record): Requests table has a serial column named ...
1
vote
1answer
37 views

Calculate value differences of rows before and after bounded by multiple referenced rows

Supposed I have a user travelling table like this: id | start_time | end_time | location | ----+--------------+------------+------------+ 1 | 1 | 2 | Loc_A | 1 | ...
1
vote
1answer
22 views

Meaning of query in pgbouncer.log

I could not find any documentation about pgbouncer log, I'm assuming it has the same meaning as the SHOW STATS ? req/s - number of requests since last stat period in b/s - Bytes per sec received ? ...
0
votes
1answer
35 views

Does PostgreSQL write first to WAL and then to data files?

This is regarding the synchronous_commit in Postgres. The synchronous_commit documentation says: Specifies whether transaction commit will wait for WAL records to be written to disk before the ...
0
votes
1answer
24 views

Creating unique constraint to be validated from input

I have this table name tbl with this table definition: create table tbl ( id serial primary key not null, counter integer not null default 1, ref_id integer not null, date_booked date ...
0
votes
0answers
19 views

difference between pg_dump command's --column-insert and --attribute-insert

Background: I'm trying to create a dump file that only contains the data in my database. I would like it to create the data with the INSERT command. In reading the manual, ...
1
vote
2answers
94 views

Building a Trending query

Is there a way to build a query that returns a record set consisting of a date and the number of records == that date? For example, I have a DB that is tracking inspections that take place on every ...
2
votes
1answer
94 views

Select data based on records created_at column

I have two tables Keywords, ProjectReports: http://sqlfiddle.com/#!15/06ae3/1 As you can see in that example everything works fine, but I want to get more data from those 2 tables and I don't know ...
1
vote
0answers
38 views

Pgpooladmin pcp commands does not work [closed]

After first installation of pgpoolAdmin I got an error e1002 with message "pcp_node_count command error occurred" Does anybody know why is this happen and how to fix this? Little update: just ...
1
vote
0answers
68 views

Does amazon rds PostgreSQL require vacuum?

It isn't clear if auto vacuum is running in rds. Thanks!