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)

0
votes
0answers
12 views

Database Design Help: MySql/PostgreSQL Single Database/Multiple Database

We are planning to build a web based custom business analytics tool using PHP and MySQL/PostgreSQL. In our application, we are planning to upload customer’s data using a Excel sheet and these data ...
0
votes
1answer
10 views

Improve performance on concurrent UPDATEs for a timestamp column in Postgres

I am using a timestamp column called updated_at for cache invalidation. More information on this particular technique here. The queries all have the same format UPDATE "managers" SET "updated_at" = ...
3
votes
0answers
35 views

Schema design for small media production

I have been recommended to post this here by my fellow programmers on Code Review SE. I'm designing a database and this is Version 3 of PsychoProductions management tool project I would like to ...
2
votes
1answer
27 views

Why is my composite index not used for this table?

I am working with a fairly complicated schema, but I've simplified it for the purposes of this question. Table "public.scheduler_appointment" Column | Type ...
0
votes
1answer
12 views

PostgreSQL - If I run multiple queries concurrently, under what circumstances would I see a speedup? Under what circumstances would I see a slowdown?

I approach you all humbly as one who is NOT a DBA, and I'm sure that my question is fraught with conceptual shortcomings and "it depends on" land mines. I'm also pretty sure that all of you who ...
0
votes
2answers
41 views

How to change schema so that account_id reference is unique among 3 tables

Original image: Updated to have more-correct terminology and an 'is_debit' column: I am designing a (PostgreSQL) schema for a lottery website that uses double-entry accounting. 'jackpots', ...
0
votes
0answers
26 views

Wrapper function with SECURITY DEFINER is slow

I have a strange behavior of wrapper function with SECURITY DEFINER option. Function 1 - Queries data what is not directly accessible by user. Function 2 - Is a wrapper that calls function 1 with no ...
1
vote
2answers
46 views

How to construct a set-based query for subset problem?

I have a DB of the following structure (picture shows simplified version) How should I construct a query to get only those recipees, that can be cooked, i.e. for each ingredient in a receipe ...
1
vote
0answers
12 views

postgres - generating documents for full text search taking forever and eating up disk space

We use PostgreSQL and Django-Haystack with Elasticsearch for search on our service, and were thinking of switching to Postgres's built in full text search because of various annoyances using a NoSQL ...
1
vote
0answers
26 views

Should one always VACUUM ANALYZE before REINDEXing in PostgreSQL 8.4?

Early in the morning every day a pgAgent job refreshes the contents of table A from table B on my PostgreSQL 8.4 database. Table A contains around 140k records across 91 columns and has two indexes - ...
0
votes
1answer
18 views

Custom personal monitor sql by writing the .psqlrc file

I want to custom my personaly monitor sql by writing the .psqlrc file , but I encounter some problems . --tablespace skypcsuit=> \db List of tablespaces Name ...
2
votes
1answer
25 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
18 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
32 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
70 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
13 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
97 views

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

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
74 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
53 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
20 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
27 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
7 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
14 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
37 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
49 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
15 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
28 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
24 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
21 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
52 views

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

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
30 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
33 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
69 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
23 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
40 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
30 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
30 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
83 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
192 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
56 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
36 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
14 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
23 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
44 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
100 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
34 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
112 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
36 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
32 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 ...