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)

1
vote
0answers
69 views

Can I add a primary key automatically for all tables?

I have a database (postgresql) with 10 schema and every schema has 10 tables. For some reasons, some tables do not have a primary key. Is it possible to create a function/trigger that can look for ...
0
votes
1answer
34 views

Return a default value in group by if selected column is null

I am trying to run a group by statement which works fine however, one of the "group" is null. How do I return "Unknown" for that row? For example: 10000 A 9999 B 9990 C 4 etc. First ...
0
votes
1answer
22 views

PostgreSQL: How does the implicit index work when using “COPY” for loading bulk rows into a newly created table?

What I know for fast loading bulk rows into a new table is: Create the table(without creating the index) Use "COPY" to load data from a file into the table Create the index What if I added a ...
2
votes
0answers
39 views

Efficiently joining two irregular series representing changes

(This is a PostgreSQL-specific question, using version 9.1, but could be upgraded to 9.3.) I have a number of tables that represent a series of changes. These tables all have the same structure: ...
0
votes
1answer
50 views

changed password for postgres login in pgAdmin, now can't connect to server

I was trying to use pg_dump to script out a database and in the process I used pgAdmin to change the password for the postgres user. I realize (now) that changing that password was a bad idea. But now ...
0
votes
0answers
24 views

use domains in multiple schemas

The PostgreSQL CREATE DOMAIN command appears to create the domain at the schema level. Is there a best approach I should be aware of that would allow me to reuse domains across the multiple schemas ...
1
vote
0answers
38 views

Guidelines on best indexing strategy for varying searches on 20+ columns

I’m running a search engine for cars. It’s backed by a postgresql 9.3 installation. Now I’m unsure about the best approach/strategy on doing index optimization for the fronted search. The problem: ...
0
votes
0answers
67 views

Performance issue in Postgresql9.3

I have very good configuration server dedicated only for PostgresSql. Server is 16 Core 122 GB RAM on Linux machine. select version(); **PostgreSQL 9.3.4 on x86_64-unknown-linux-gnu, compiled by gcc ...
0
votes
0answers
28 views

Slow search times with functions despite index?

I'm aware that this question might be under the guidelines of being closed, but I'm out of ideas at the moment on how to optemize this table any further. Given a have a few billion records with ...
3
votes
0answers
70 views

PostgreSQL custom operator for equality

I want to build a custom equality operator in PostgreSQL, which can be used in GROUP BY, UNION and DISTINCT [ON] for the json type (just for the sake of curiosity, not for real-world implementation -- ...
0
votes
1answer
33 views

I need to copy data from remote Postgres server that has limited disk space and limited connectivity to a server

I have a remote Postgres server recording some data every second. the server has very less space like 6-7 GB, currently I write data to a remote VM server but due to poor connectivity the applications ...
2
votes
0answers
72 views

Postgresql trigger - get all changed rows after transaction

I have invoice_item table and invoice table. I need to check total price of Order after each transaction. Since I still want to be able to change things, I need trigger after each transaction. CREATE ...
1
vote
0answers
88 views

How to improve query performance in PostgreSQL? [closed]

I have the following query to be execute within a second but getting time for execute 2.8 minutes: Query: Using Common Table Expression. explain analyze with temp_cte as ( Select ...
-1
votes
1answer
31 views

Maximum limit for COPY FROM STDIN in postgres

May i know what is the maximum number of records that can be inserted. In my program, it works for around 20000 file reading and inserting into db. But the total count is 4 lakhs. When i try with 4 ...
0
votes
0answers
22 views

General tuning in PostgreSQL [closed]

I need to do general tuning for PostgreSQL 9.3 version. I have postgresql configuration file with the following details: max_connections = 100 shared_buffers = 128MB effective_cache_size = 128MB ...
2
votes
0answers
40 views

How to make PostgreSQL default_tablespace work properly?

My question is, "Why isn't database 'screwy' created in tablespace 'screwy'? I made the following script, with it's output following, to show the problem I am having : #!/bin/bash # export ...
1
vote
0answers
16 views

Optimize finding the next batch of data from A to be crunched and inserted into B

I'm using PostgreSQL to store data produced by a large distributed computation. There are several stages to this computation; the idiom we've settled on is that there's a table containing the results ...
1
vote
1answer
27 views

Why changing the database owner doesn't change the owner in PostgreSQL dump?

I was exporting a database using pg_dump command when I realized that the owner of the database had to be changed. So I change it, and make extra sure that the newuser is correct. Then try the command ...
1
vote
1answer
279 views

could not save history to file “/var/lib/postgresql/.psql_history”: No such file or directory

I'm following this tutorial to set up my postgresql db. http://inventtheweb.blogspot.ca/2012/05/install-postgresql-for-django.html After I finish running the CREATE DATABASE command and run \q I ...
0
votes
1answer
57 views

Issue working with Postgres on Windows

I am running PostgreSQL 9.3 on my machine. I have PhpPgAdmin running on a cloud, using which I exported the database I am supposed to be working on, selecting "Structure and Data" and "Download". ...
1
vote
0answers
28 views

Problems while building plpgsql_check on Windows

I try to build plpgsql_check extension by @PavelStehule (Erwin Brandstetter recommended it to me in this answer) on Windows XP 32bit with Visual Studio 2010 (I used this article as a manual). However, ...
0
votes
1answer
48 views

How to get pg_archivecleanup on Amazon Linux 2014.03?

I have an Amazon EC2 instance based on Amazon Linux AMI 2014.03. I installed PostresSQL from their repos: yum install postgresql-libs postgresql postgresql-server postgresql-devel I've read about ...
1
vote
1answer
41 views

Postgres resource management

I'm consolidating multiple Linux boxes running Postgres into one box. Given the way Postgres handles resource utilization, would one single server service handling all the databases provide a much ...
4
votes
2answers
56 views

Update SQL n:n table with multiple associations

I have done this before, but before I mindlessly repeat something that I consider as a hack, I'm asking here. I have 3 tables (details left out for clarity) : inv_items id bigserial (PK) sku ...
1
vote
1answer
52 views

Does PostgreSQL support multi-threaded replication?

Is PostgreSQL replication single-threaded ? Are there any tools to achieve multi-threaded replication ? I'm asking this since Mariadb support this and currently I'm learning both these dbs.
0
votes
0answers
12 views

Creation of a table with foreign keys in postgres is taking longer time [duplicate]

I am wondering if someone can help me understand this. I tried to add an column to a table of 22000 rows which is referencing other tables(one of these tables have 0.5 million records). It didn't ...
1
vote
0answers
95 views

PostgreSQL continuous archiving - use snapshot for base backup on AWS?

I'm new to AWS and PostgreSQL admin and have been poring over the docs trying to come up with a good backup strategy for a fairly simple setup. I have a single Amazon Web Services EC2 instance that ...
1
vote
0answers
156 views

Mariadb new features vs PostgreSQL? [closed]

Mariadb 10 offer lot of new features. ( https://mariadb.com/products/mariadb/mariadb-vs-mysql) . I want to know, with these new features, will PostgreSQL would be a better solution for newly starting ...
0
votes
0answers
17 views

setting auto-increment value of primary key to maximum in postgre sql [duplicate]

the sequencing of my auto incremented id value which is also primary key of the table has changed due to some unknown reason. i want to know whether i can reset this value to the maximum value by ...
2
votes
1answer
66 views

Difference between pg_column_size(table.*) and pg_column_size(table.col1) + pg_column_size (table.col2)

From PG DOC pg_column_size(any) : number of bytes used to store a particular value (possibly compressed) pg_column_size shows the space used to store any individual data value Example: ...
0
votes
0answers
66 views

Data Synchronization from SQL-Server to PostgreSQL

I am trying to figure out the best method for duplicating data in one-direction from a SQL-Server database to PostgreSQL. I know that there are no replication providers for SQL-Server to PostrgreSQL. ...
1
vote
2answers
125 views

What is a good solution for reliably transferring data between SQL Server and PostgreSQL?

In analyzing some of our business data, we're realizing that we need to join data across disparate data sources. For example, our application data is warehoused in Postgres (ported from MongoDB via ...
0
votes
1answer
35 views

Postgresql Function Trying to Insert into 1 row instead of 2

Postgresql 9.3, Mac OS X 10.6.7 I created this function and I would like to insert both results into the same row. Obviously the way I have it inserts into 2 rows. First, here is the Table T1: ...
2
votes
1answer
71 views

storing millions of rows of denomalized data or some SQL magic?

My DBA experience doesn't go much further than simple storage + retrieval of CMS style data - so this may be a silly question, I don't know! I have a problem whereby I need to lookup or calculate ...
1
vote
2answers
40 views

Can I find errors without using testing data for all the branches of each function?

In PostgreSQL, syntax errors (except for trivial syntax errors) are reported while running the code in question; unlike Oracle, PostgreSQL can't find errors without running the part of the code. This ...
3
votes
1answer
110 views

Optimizing concurrent updates in Postgres

I'm running concurrent Postgres queries like this: UPDATE foo SET bar = bar + 1 WHERE baz = 1234 Each query affects the fixed K number of rows, and I can't find a way to enforce the order in which ...
0
votes
1answer
48 views

How to start my 9.2 data directory using an 8.4 server?

I have an old version of postgres (8.4.13) that doesn't run for various reasons. I plan to move the database files in there to a new install of postgres 9.3. How would I go about doing this? For one I ...
0
votes
1answer
67 views

Using the correct postgres server

I'm not sure what happened but I logged in on friday and did psql -d name to access a db that was perfectly running just fine. Then I log in this monday morning and try to access the same database ...
4
votes
2answers
70 views

Postgres reported table / db size varies wildly from dump size

I have a very strange misreporting of the size of one specific database. According to \l+ in psql the DB size is 292 MB. Doing a sum over the sizes reported by the following statement also reports ...
0
votes
1answer
40 views

Implementing Permissions Database structure on a PHP site to restrict the Access in Multiple levels

I am working on a PHP site that shows the business of a Vehicle Showroom company in which we have 3 users as, Admin(Owner) = Here Admin Have all Access by default(View,Edit,Delete to all) Super ...
1
vote
0answers
48 views

Join and aggregate result and insert blanks for missing appendants

Consider these two simplified tables: CREATE TABLE "sources" ( "id" serial NOT NULL, "name" text NOT NULL, CONSTRAINT "sources_pkey" PRIMARY KEY ("id") ); CREATE TABLE "values" ( ...
2
votes
1answer
71 views

In Postgresql, after pg_dump the access privileges on the database itself are not restored

Suppose user foo owns a database gee, and user foo has granted user bar with all access privileges on database gee gee=> \l List of databases Name | Owner | ...
1
vote
3answers
99 views

Postgresql: datatype for email address

What would be the right datatype to store email addresses in PostgreSQL? I can use varchar (or even text), but I wonder if there is a more specific data type for emails.
2
votes
2answers
86 views

Official PostgreSQL Capitalization conventions [closed]

Is there an official PostreSQL convention regarding capitalization in DB, Table and field names? The examples on the official site suggest a lowercase and _ word separation, and I wonder whether this ...
2
votes
1answer
33 views

Rewrite sqlite trigger to postgresql

Can you help me please with this problem? I need rewrite this simply trigger from sqlite to PostgreSQL format: In sqlite: CREATE TRIGGER connections_INSERT_update_connection_root_trg ...
1
vote
1answer
47 views

“Recover” data from running PostgreSQL instance; data directory was deleted

I accidentally removed data directory /var/lib/pgsql/9.1/data from running postgresql server. I guess I'm going to lose my data when server will be restarted. I'm wondering if postgresql has any ...
0
votes
1answer
34 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 ...
0
votes
0answers
31 views

PostgreSQL and Single Table Inheritance

I read about STI (Single Table Inheritance) and like the idea. Does PostgreSQL handle 95% NULL values in some columns if I have about 1M rows well? Does it impact performance if there many columns ...
1
vote
1answer
48 views

Postgres: my “data/backup” directory is way too large

In my postgres 9.3 data directory, there exists a subdir called "backup" that is 6.1G compared to my pg_xlog which is only 130M. I understand that pg_xlog is the WAL logs, so what is in the backup? ...
0
votes
2answers
66 views

What is the Maintenance DB asked by pgAdmin?

pgAdmin dialog for adding new database connections asks for a "Maintenance DB". In order to be able to connect, I set it to the database I want to connect (and also, I have the rights to connect). ...