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)

0
votes
1answer
21 views

How does PostgreSQL decide which query to cancel during deadlock cleanup

I know that PostgreSQL will detect and clear deadlock once it happen by cancelling one of the queries. How does PostgreSQL decide which one to cancel? Is this deterministic or there is some randomness ...
2
votes
1answer
102 views

Should database be denormalized if I need an index across multiple tables

I have a catalog of album and song names. The song has a foreign key to the album table. I expect queries like: SELECT * FROM song s JOIN album a ON a.id = s.album_id WHERE LOWER(CONCAT_WS(' ', ...
0
votes
0answers
14 views

How can I use PostgreSQL's partial sum tree index (if it even exists)? Do any databases allow for use of such an index?

GiST (Generalized Search Tree) indexing is an advanced system which brings together a wide array of different sorting and searching algorithms including B-tree, B+-tree, R-tree, partial sum trees, ...
1
vote
1answer
254 views

REST webservice as a Foreign Data Wrapper in postgresql

I know it's possible to embed data from a foreign resource in a postgresql database as a foreign table and have seen examples including redis, another postgres database, etc but I can't really find ...
-3
votes
1answer
17 views

In Postgres, what is the relationship between a SEQUENCE and a SERIAL? [on hold]

Postgres has the ability to define SERIAL datatypes and SEQUENCE but they seem to overlap in function. What are the main differences ?
0
votes
0answers
28 views

For Postgres, how would I define a custom function to generate primary keys?

In postgres, primary keys are typically generated using a SEQUENCE. I am hoping to generate a unique random 12 character string for use as a primary key. How would I do this in Postgres?
2
votes
1answer
100 views

PostGIS: Cutting Holes in Self Geometry

I have a table of geometries in PostGIS, some of which overlap. When I display the geometries, this has the unfortunate consequence of blending the two stacked geometries together and producing an ...
0
votes
0answers
26 views

What's the difference between a using partitioned table and using partial indexes based on the partition key? [on hold]

I have a users table that is almost always queried by the customer column. I'm looking into making those simple select queries more efficient. I came up with two ways to do it: Partition the table ...
0
votes
0answers
31 views

where can i learn nosql for postgres [closed]

Postgres has recently made major improvements on its handing of noSql. I would like to learn more about using nosql especially its document or blob store formats to create data for a chatbot I am ...
1
vote
2answers
116 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 ...
0
votes
1answer
663 views

pgpool2 setup on master-slave replication using postgreql 9.1

I have already setup 2 ubuntu server 12.04 LTS on my local machine using virtual box and is using the master-slave replication (postgresql 9.1). 192.168.0.109 = master 192.168.0.110 = slave my ...
0
votes
0answers
34 views

Building a database in Postgres in real life - psql cli, .sql script files, gui? [closed]

I have been learning Postgres by reading tutorials, which assume you're typing commands one-by-one into the psql command line. That's fine in tutorial world. But in real life development, when ...
0
votes
1answer
25 views

Are file locations stored in PostreSQL catalog?

I am trying to learn a bit of PostgreSQL, and I am currently trying to understand the catalog. I think that if it stores all the metadata of the DB, should it also store things like the file ...
0
votes
1answer
112 views

Postgres automatic failover, multiple clients to multiple masters

I'm looking into providing a method of having multiple hot spare PostgreSQL instances to our website. The majority of implementations that I have found require a single point of failure with PgPool ...
4
votes
2answers
1k views

Postgres log files not rotating

I have a postgres system with a hot standby server. They use the same config file. I've setup the log rotation to use log_rotation_size and log_rotation_age so that the master server is rotated every ...
0
votes
0answers
22 views

Postgresql Hot Standby - How to determine it's fully mirrored?

I have set up a hot standby of a postgresql server. It all seems to be working, but I just want to be sure that I'm not missing something. In /var/lib/pgsql/9.2/data/pg_log/postgresql-Wed.log I have ...
0
votes
0answers
33 views

Forcing FK constraint to validated in system catalog

I have a big table (~60gigs, 35mill+ rows) that I need to add a FK to. Adding a FK directly to the table causes a validation which runs for about 30secs that I want avoid as it's a 30sec access ...
0
votes
0answers
18 views

New Table vs Java Beans to allow user to dynamically change data representation?

I am building a database to store the assessment records of students, along with other relevant information and functionality like reporting on average scores etc. Currently my company uses Excel for ...
0
votes
1answer
40 views

Query across schemas in PostgreSQL [closed]

In PostgreSQL, I have a table which, due to sharding, exists across many schemas. In sub-optimal cases, I need to execute a query on all of these schemas (due to an exception which violates the ...
0
votes
1answer
27 views

Postgres privileges: psql \dp - what is about the plus-sign

I used psql-command "\dp" to find out the given grants. Versions on test-server: PostgreSQL 9.1.15 on armv7l-unknown-linux-gnueabi, compiled by gcc (Debian 4.6.3-14) 4.6.3, 32-bit Out of the ...
0
votes
1answer
31 views

Postgresql query history hacking

I believe that PostgreSQL can log slow or unsuccessful queries. Probably I can set also PostgreSQL to log all queries executed. Contrarily, I am interested to know if there is a way that a malicious ...
0
votes
1answer
32 views

Simple join in postgresql [closed]

I have a simple join query below : select jobs.location_id from companies, jobs where jobs.company_id = companies.id and companies.name = 'name'; it doesn't seem to get the job location of ...
0
votes
3answers
34 views

Last occurance of time relative to now()

What's the most elegant way to ask Postgres for the last 4:05pm relative to now()? I have been writing a fairly elaborate CASE with date_trunc's and my guess is it can be accomplished in a much ...
0
votes
1answer
41 views

VACUUM FULL fails with 'ERROR: Check free disk space'

I am using Postgres 9.4. I have a database that \l+ tells me is 164 GB. When I try to run VACUUM FULL on the database, I get this error (after many hours): ERROR: could not extend file ...
0
votes
1answer
21 views

Upgraded Postgres; how to access now-missing databases?

My local connection on my Mac (10.9.5) wasn't working to my Postgres (9.3) database (and therefore I couldn't actually export the data), so I tried upgrading it to 9.4. Luckily I can now connect to ...
9
votes
2answers
7k views

Efficient query to get greatest value per group from big table

Given the table: Column | Type id | integer latitude | numeric(9,6) longitude | numeric(9,6) ...
3
votes
1answer
109 views

Unused index in range of dates query

I have a query that is not using existing indices and I do not understand why. The table: mustang=# \d+ bss.amplifier_saturation Table ...
5
votes
1answer
2k views

VACUUM returning disk space to operating system

VACUUM usually does not return disk space to operating system, except in some special cases. From the docs: The standard form of VACUUM removes dead row versions in tables and indexes and marks ...
1
vote
2answers
68 views

How to select data in the same table on different rows that are empty?

I use this select on my SQLite database: SELECT attributeX FROM table GROUP BY attributeX HAVING COUNT(attributeY) = 0; My table: attributeX (type integer) | attributeY (type text) ...
0
votes
0answers
50 views

Can't install postgis on PostgreSQL 9.4 [closed]

I need to install postgis into my PostgreSQL 9.4 server locally. I've taken the shotgun approach and installed all related packages for postgis: sudo apt-get install postgis* however, executing: ...
0
votes
1answer
825 views

How to add FK on a column of composite type in PostgreSQL?

I have a table which contains a composite type and I am trying to connect a column of it to another table's PK. CREATE TABLE aaa (col1 SERIAL PRIMARY KEY); CREATE TYPE bbb AS (col2 INTEGER); CREATE ...
1
vote
0answers
28 views

Query for a table with paging and filtering vs. CTE (common table expression)

Intro In PostgreSQL 9.3: I am building a query that fetches data for a table that supports sorting, filtering and paging. Think Customers for example, you want to show name, surname, some detailed ...
3
votes
1answer
382 views

PostgresSQL dynamic execute with argument values in array

I'm wondering if this is possible in Postgres: Best explained using a contrived example: create or replace function test_function(filter_param1 varchar default null ...
1
vote
1answer
121 views

How to get back the PostgreSQL database to a specific point in time?

I was running a batch script in a PostgreSQL database which inserted values in different tables between 10:40 and 11:00. Later I came to know that the script was executed mistakenly. How can I get ...
3
votes
1answer
828 views

Best practice for storing record metadata

What is the best practice for storing metadata of individual records in a database? I need to store common meta data such as creation time and time of last update for many tables in my database. I ...
1
vote
0answers
35 views

Postgres-XL does not insert rows

I have successfully installed and started postgres-xl on localhost(Ubuntu 14.04). (Two datanodes, 1 coord) The problem is: 0 rows after insert CREATE TABLE test1 ( id bigint NOT NULL, profile ...
0
votes
0answers
30 views

Postgresql match all in full text search

Is there anyway that we can specify the tsquery to match all ? I have tried SELECT 'a fat cat sat on a mat and ate a fat rat'::tsvector @@ '*'::tsquery; but it doesn't seem to work. It returns ...
2
votes
1answer
23 views

Converting a GraphDB schema to a relational database schema

I currently am using a graph database and am considering moving off of it to a relational database like Postgresql. My concern is that I have lots of relationships between entities (since this is ...
0
votes
1answer
40 views

no pg_hba.conf entry for replication connection from host

(Also posted to pgsql-general) I have been configuring a slave server that needs to connect to the host. Both the master and the standby servers have a pg_hba.conf that looks like this: # Allow ...
0
votes
1answer
194 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 ...
5
votes
1answer
313 views

Why is a new user able to create tables in PostgreSQL?

I followed two tutorials to create a DB with: a fully privileged user link a read-only user link I then got a tip from CJ Estel's tutorial stating that "you may have inherited the ability to ...
3
votes
1answer
45 views

'ERROR: text search dictionary “unaccent” does not exist' during CREATE INDEX?

I'm running PostgreSQL 9.3 on Mac OS X Yosemite. I try to create an unaccent lowercase trigram index. To achieve it I did this: mydb=# CREATE EXTENSION pg_trgm SCHEMA public VERSION "1.1"; ...
0
votes
1answer
19 views

Behaviour of Bulk Insert in pgsql or any Database

I'm using PostgreSQL 9.2.4. I'm working with multiple tables with large number of data. I have two tables Table_One which has one of the field with varchar(250) and Table_Two with one of the field ...
0
votes
2answers
124 views

Schema for lists of relationship differences

Say there is a data model that allows for relationships to be defined either explicitly or as a list of records added or removed relative to some existing item: Item <–> *Properties and Item ...
19
votes
2answers
13k views

Create index if it does not exist

I am working on a function that allows me to add an index if it does not exist. I am running into the problem that I cannot get a list of indexes to compare to. Any thoughts? This is a similar issue ...
0
votes
0answers
22 views

How do I know Postgres streaming replication is working?

I have set up a standby server to follow a primary Postgres server following [this wiki page][1]. The issue is that I am not sure the primary server is sending anything to the replica because I don't ...
0
votes
1answer
14 views

pg_basebackup fails with “ too many connections for role ”replication“”

I am trying to set up a standby server and keep getting this error. My primary server has more than enough connections to handle the load: listen_addresses = '*' wal_level = hot_standby ...
-2
votes
1answer
13 views

creating a user with no DDL privileges in Postgresql [closed]

I want my Django web-app (ORM-based framework) to connect to connect with a user who has no DDL privileges. The tutorial I followed created me a user that has full DDL privileges: GRANT ALL ...
3
votes
2answers
875 views

Slow queries on billions-rows-table // index used

Since I'm a young developer and not really skilled in using databases (PostgreSQL 9.3) I ran into some problems with a project, where I really need help with. My project is about collecting data of ...
0
votes
1answer
22 views

pg_basebackup: could not connect to server: fe_sendauth: no password supplied

I'm trying to set up streaming replication between two Postgres servers. The master server's pg_hba.conf file is configured this way: host replication ${REP_USER} 0.0.0.0/0 ...