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)

5
votes
3answers
691 views

How to keep an unique counter per row with PostgreSQL?

I need to keep an unique (per-row) revision number in a document_revisions table, where the revision number is scoped to a document, so it's not unique to the whole table, only to the related ...
0
votes
1answer
114 views

pg_timezone_names view is empty - can be recreated?

For some strange reason pg_timezone_names view is empty. Is there a way to recreate it?
2
votes
1answer
141 views

Choosing A PostgreSQL Authentication Method For A Large Course

I am teaching a first course in databases for the first time. Students will need to have a database management system to which they can connect to do much of their work for the course. I have chosen ...
2
votes
1answer
917 views

hstore for versioning fields in postgresql

I have a postgresql database that will hold about 50 tables, each of them having about 15 fields, it would have at least 300.000 rows on each table. In order to track the changes done on each field I ...
5
votes
1answer
542 views

Difference between idx_tup_read and idx_tup_fetch on Postgres

On Postgres 8.4 when you do: select * from pg_stat_all_indexes where relname = 'table_name'; It returns the fields idx_tup_read and idx_tup_fetch, what is the difference?
1
vote
1answer
193 views

Confused over encoding/locale in postgresql

I am a little confused over the difference between encoding and locale as it pertains to the postgresql database. When initializing the database, you can specify both an encoding and a locale. ...
0
votes
1answer
167 views

pg_dump: SQL command failed

I am trying to take backup of postgresql 9.0 by using pg_dump command. command here is: cd /opt/PostgresPlus/9.0AS/bin and hit the following command pg_dump -h xxx.xxx.xxx.xxx -p 5432 -U superuser ...
1
vote
1answer
232 views

Should I be concered by large SERIAL values?

I have a Django application that uses PostgreSQL to analyze data from tweets. The data set increases by thousands of records with each request. I am using the database primarily as a cache, so I had ...
2
votes
2answers
246 views

Trigger update does not seem to finish

I'm new to PostgreSQL triggers & functions and such. I've got a table: keywords and each keyword should be unique. So when I try to insert a keyword that already exists, it should simply update ...
1
vote
1answer
487 views

In PostgreSQL 9.3 , UNION VIEW with WHERE CLAUSE not taken into account

We use Postgres 9.3, we want to split a large database (evaluated final size will be > 100 T) on many servers. As our users already have a set of existing queries, we cannot use solutions like ...
0
votes
1answer
1k views

How to create an Sql table from SELECT with a multiple row DISTINCT constraint?

I want to create a table from a SELECT statement based on a multiple row DISTINCT, but PostgreSQL does not allow me to do it. I need to create a table where the elements were previously selected from ...
4
votes
3answers
3k views

Select rows, where 3 columns have the same values

I have a structure like this: col0 col1 col2 col3 1 1 1 1 1 1 1 2 1 1 1 3 1 2 1 1 1 2 3 1 2 3 4 5 2 3 4 9 I now want to select ...
-3
votes
1answer
84 views

Make “NOT NULL” default in Postgresql 9.2 [closed]

I use NOT NULL a lot when creating columns. Is there a way to make this default when defining columns? In other words, make column is_nullable default to NO. (I realize this would make it harder ...
3
votes
1answer
107 views

Fill factor based on index ranges

I'm designing a Postgres database for an events app. The app lists events sorted by when they start. Initially the app displays only 30 events. As users scroll through the list of events, more ...
2
votes
3answers
269 views

Monthly backup of SQL server DB to PostgreSQL?

The company I'm working for has a SQL Server with read-only access. They use Crystal Reports hooked up to PostgreSQL for reporting. Is there any way to make it so I can move all the data from the ...
2
votes
2answers
1k views

Select a range of integers

I have a 'range' of integers (in this case destination ports) that occur: For example: 33848-33254. I want to select 'all' of these without having to do one at a time. is there a range operator? Or ...
0
votes
2answers
270 views

Installing PostgreSQL 9.2 and PostGIS 2.0 on Ubuntu 12

At the current moment, March 4th 2013, can PostGIS2.0 be install with PostgreSQL 9.2? I checked their website and to my understanding it is not possible... I hope that's not the case. Can anyone ...
-5
votes
1answer
158 views

how to being building a data warehouse [closed]

We have a ERP system that uses a DB in postgres, each table has many rows and we want to build data warehouse (data warehousing). Also we want to add BI using ETL where would begin? would use schemes ...
3
votes
1answer
420 views

PostgreSQL COPY: is it always faster to delete and recreate indexes?

In this answer, Erwin Brandstetter recommends It is also substantially faster to delete indexes before a huge bulk INSERT / COPY and recreate them afterwards as it is much more costly to ...
4
votes
2answers
1k views

PostgreSQL CREATE TABLE creates with incorrect owner

I'm using PostgreSQL 9.2.4. When I create a table as a non-superuser in a database owned by that non-superuser, it is owned by the postgres user, so I can't put any data into it unless I explicitly ...
-1
votes
2answers
349 views

PostgreSQL kill - Sighup pid [closed]

To reload the configuration files, we send the SIGHUP signal to the postmaster, which then passes that on to all connected backends. That's why some people call reloading the server ...
1
vote
1answer
139 views

Which all system parameters to be considered for standard Vacuum process

We want to run standard vacuum process on our production database which is over 100 GB and have millions of dead tuples. Can anyone suggest what system parameters we need to keep in mind for setting ...
1
vote
1answer
346 views

postgres+JDBC: fire trigger with non autocommit transaction

i have a jdbc client that make an two INSERT query on database whitout autocommit, and a trigger on database that fires when a insertion is done on a certain table public foo() throws MyException { ...
2
votes
0answers
273 views

PostgreSQL index array of int4range using GIN / GIST - custom operator class

Here is my table: CREATE TABLE mytable ( id INT NOT NULL PRIMARY KEY, val int4range[] ); I want to index the val column: CREATE ...
2
votes
2answers
208 views

Adding an index to a system catalog in Postgres

I'm having a situation very similar to the one described here: I've got a SaaS situation where I'm using 1000+ schemas in a single database (each schema contains the same tables, just different ...
2
votes
2answers
134 views

Scaling beyond 16 concurrent connetions

I've just adopted a Postgres 9.0 database running on RHEL 6.1 on a rather beefy 256 core, 2TB system with ok drive (Hardware RAID 50). I've started benchmarking the system using pgbench so I can get ...
0
votes
2answers
85 views

Advice on scripting a “whitewashed” and downsized development db from main db

Currently we (an active opensource project) have a large PostgreSQL production database which contains all the site records. Since we can't just allow every developer or contributor access to the ...
1
vote
2answers
495 views

Avoiding a sort on an already clustered index for group by

On a table T with two fields, pid and did, the following query results in a seq. scan followed by a sort on pid: select count(did), pid from T group by pid Here is the query plan: ...
0
votes
0answers
16 views

Postgres 9.1.6 Error: index contains unexpected zero page at block 0 [duplicate]

I have setup streaming replication on Postgres 9.1.6 running on a debian server and it's going on fine. When I try to run a query on the replica DB I get the error below: ERROR: index ...
1
vote
0answers
507 views

Postgres 9.1.6 Error index contains unexpected zero page at block 0

I have setup streaming replication on Postgres 9.1.6 running on a debian server and it's going on fine. When I try to run a query on the replica DB I get the error below: ERROR: index ...
0
votes
2answers
124 views

Recommendation for RDBMS for large table [closed]

I have been asked for recommendation on the optimal RDBMS for a large amount of data. The largest table would contain 2TB of data. My own largest table is only 400GB (mysql, performs very well). The ...
1
vote
1answer
68 views

Try to define appropiate memory size for this postgres database

I have a site with around 150.000 daily page views using a 180Mb postgres database size running on a 800 mb ram db on Heroku. This site does not do many updates, queries are mostly select that are ...
7
votes
2answers
722 views

Convert units of measurement

Looking to calculate the most suitable unit of measurement for a list of substances where the substances are given in differing (but compatible) unit volumes. Unit Conversion Table The unit ...
3
votes
1answer
539 views

Profiling PostgreSQL

We have a system built with Python 2.7, Django, PostgreSQL 9.1 and PostGIS 1.5. In this system there is some extensive validation processes that are, well, intensive. Our machine: SO: CentOS 6 HW: 8 ...
-2
votes
1answer
165 views

Query sql-server db and insert results into PostgreSQL

I have a query that returns data from sql-server and I need to be able to put the results into PostgreSQL. I'm using C# for the task.
0
votes
1answer
1k views

pgsql slow query on table of 500 million rows

I have a table that keeps measurements of latencies between nodes running MPI tasks in a large cluster. The table looks like this: CREATE TABLE latency( from_rank int, to_rank int, from_host ...
2
votes
1answer
548 views

I need help understanding Postgres's archive cleanup functionality

I'm reading http://www.postgresql.org/docs/9.2/static/pgarchivecleanup.html and to me it seems like it will remove any and all WAL segments from my slave server that aren't required to perform ...
5
votes
1answer
584 views

PostgreSQL strategies to deal with disk filling up

I'm using PostgreSQL (8.4) to store data produced by an application making frequent inserts (in the table structure described below). The database keeps growing with time and, since the newer data is ...
1
vote
1answer
282 views

Have aggregate function group results in one row

I have a table that has the following columns: debit credit payment_method class Now I will perform this query: select sum(debit - credit), payment_method, class from my_table group by ...
4
votes
1answer
588 views

What are the privileges required to execute a trigger function in PostgreSQL 8.4?

What are the privileges required to execute a trigger function in PostgreSQL 8.4? It seems that the privileges set to a role does not matter to execute a trigger function. I think I have seen some ...
8
votes
2answers
10k views

How to I grant a user account permission to create databases in postgresql?

Title says it all. I cannot figure out how to give a user account the ability to create and drop databases. Is there a way to do this with GRANT ?
1
vote
1answer
1k views

Connecting to postgres from windows to virtual machine

I have the following setup Windows 8 Oracle VM virtual box with arch Linux running on it Installed and configured PostgreSQL on Linux Setup the ports in virtual box so that 45432 port on windows ...
1
vote
2answers
108 views

Constraint on Composite Type

How can I create a constraint on a sub-field of composite type? Pseudocode create type axis( major_axis float, minor_axis float, angle float constraint angle_constraint check(angle ...
3
votes
1answer
322 views

Group By primary key or DISTINCT increase query time over 1000x with limit

Also see http://stackoverflow.com/questions/17741167/hibernate-jpa-improve-performance-of-distinct-query but I realized this is mainly a PostgreSQL issue. My application uses a 3rd party extension to ...
2
votes
2answers
1k views

PostgreSQL difference between VACUUM FULL and CLUSTER

I have a table with 200 GB of size occupied by data and 180 GB of size by the 6 indexes on it. It is 30% bloated, so I want to reclaim unwanted space occupied by it. It is clustered on job_id_idx ...
1
vote
0answers
495 views

How to configure pgpool for reasonable speed

I have a problem with pgpool II configured in master-slave mode with replication on slony. I have configured postgres databases on each server to run as fast as they can and this was verified by me ...
4
votes
1answer
911 views

Transpose two-dimensional array from n rows to 2 columns

Background Using PostgreSQL 9.1, so WITH ORDINAL (a 9.4 feature) is not available. Problem Looking to simplify the code that pivots a two-dimensional array. Code A working, overly-verbose example ...
2
votes
1answer
1k views

Postgresql out of memory while trying to a request of ~500mb

I started getting out-of-memory errors on os postgresql-9.1 server running on a x64 Debian with 4GB of RAM, dedicated to postgresql. Top returns something like this, which seems that the problem is ...
3
votes
2answers
701 views

How do I know what indexes to create for a table

Is there a way I can figure out the best way to know which indexes to create for a table?
1
vote
1answer
143 views

Index method for very few updates and many inserts

I am using Postgresql 9.1 with *pg_trgm* extension. I need to create an index on a text-based field. I do not need full-text searches, I use ILIKE queries to make my searches. I will use pg_trgm but ...