PostgreSQL 9.3 : 2013 release of PostgreSQL

learn more… | top users | synonyms (1)

3
votes
0answers
21 views

What do the shared buffers metrics for various types of index scans represent?

TL;DR: When an "EXPLAIN (BUFFERS)" shows an "Index Scan", it does not show the number of pages needed to be read from the index. Is it just omitting that number, or does it actually not read pages ...
0
votes
2answers
8 views

Create postgres schema in db with multi user in AUTHORIZATION

Is it possible to create a schema that is owned or accessible by more than one user in the same database? I was reading postgres create schema documentation and postgres alter schema documentation ...
0
votes
0answers
14 views

Tuning Postgresql autovacuum [duplicate]

Setup I have a problem similar to the one described and not solved here , with some differences... I am using Postgresql 9.3 on Ubuntu 14.04 where I have a Django project running with celery. I ...
0
votes
0answers
23 views

backup only few tables in postgresql [on hold]

I have PostgreSQL database with more than 20 tables. I need to take backup only certain tables along with schema that should stored as zip. So that i can restore to empty database with tables and ...
0
votes
0answers
22 views

Multi-core PostgreSQL server - how to improve performance [on hold]

I have a PostgreSQL 9.3.5 server with 8 CPU cores. I've noticed that adding cores to the server doesn't improve its performance. It is probably caused by the fact that Postgres doesn't support ...
0
votes
0answers
18 views

PostgreSQL 9.3: Minimize locking when updating a large table with primary key

I am building a DB solution to handle a fast stream of online events. Each event UPSERTs a row in a location_update table, using its car_id primary key. Since there are very few new car_ids, the ...
0
votes
0answers
15 views

UPSERT-ing large batches in PostgreSQL 9.3 on AWS RDS

Consider the following location updates table , which keeps the most recent location update of each car_id. The table has the following columns: car_id - a textual primary key geom - a PostGIS ...
3
votes
0answers
35 views

Complete deadlock on PostgreSQL 9.3 after removing a numeric id

The problem - complete DB lock after a schema change Architecture I use a PostgreSQL 9.3 with PostGIS to store location updates. The updates are written to two tables - location_updates and ...
0
votes
0answers
16 views

Strange Intermittent Postgres Performance Issue (docker?)

I am running a local Postgres 9.3 in a docker container with a temporary database that is used for some file import operations. The basic scenario is: Load files into input tables INSERT from a ...
-2
votes
2answers
30 views

How can i get list of postgresql database through php or using just sql query? [duplicate]

What i want to do is to make a drop down list of all the databases of my postgresql 9.3 server using php . if i can get just the sql script that can do the trick then i can handle the php part. ...
1
vote
1answer
24 views

Unexpected results with soundex() function when combined st_distance()

select soundex(A.name), A.gid, A.name, soundex(B.name), B.gid, B.name, st_distance(B.the_geom,A.the_geom) * 111.325 as dist from (select name, ...
-1
votes
0answers
38 views

insert or update on table “ aaa” violates foreign key constraint [closed]

I am trying to migrate from mysql to postgres, while restoring into postgres its showing the constraint error. Table1: server : column user_login has an entry for admin user. (It has an entry for ...
2
votes
0answers
17 views

PostgreSQL/PostGIS: Query seems inordinately time-consuming

I'm doing what I would consider a pretty straightforward query on two tables that aren't huge (~626k records in one; ~47k records in the other). Both tables have GIST indices on their spatial ...
4
votes
2answers
70 views

Grouping by sequential relationships with Postgres

This is quite similar to this question about continuous ranges, and this question about grouping by sequential numbers, but differs in that the sequences are not numeric. Given the following ...
3
votes
2answers
121 views

Filter and append data to row

My query and my data set (copied from sqlfiddle): CREATE TABLE one ( id int4 primary key, p_id int4, k_id int4 ); CREATE TABLE two( id int4 primary key, p_id int4, k_id int4, ...
3
votes
1answer
83 views

psql breaks if I specify host localhost

I am aware that this or similar has been asked in other places. None of the other answers have worked for me. Machine is a Macbook Pro 2014 / OS X Yosemite 10.10 with Postgres 9.3.5 installed via ...
0
votes
1answer
42 views

How to find similar (but different) names with the same soundex value?

I got the output with the same name and same soundex value, but I want the result which has similar name and same soundex value. Can anyone help me to do this?
1
vote
1answer
45 views

How can I improve this query in PostgreSQL?

I've been using PostgreSQL for a little over a year. I am continually whacked by queries that have counts in them, such as: SELECT COUNT(*) AS count_all, listings.id AS listings_id FROM "listings" ...
3
votes
1answer
29 views

Single table or multiple table design when records have a clear distinction but are queried together?

Let's say I have the following types of recurring data (all types periodically come in). Post (Title, Summary, Text, Timestamp) Image (URL, Caption, Timestamp) Event (StartDate, EndDate, Title, ...
0
votes
1answer
29 views

When does pg_dump not export CREATE EXTENSION?

I have a production database that I am trying to dump then load (in plain text format) locally. The problem is, the database being dumped uses the hstore extension in several tables, and contrary to ...
2
votes
2answers
56 views

Locking issues under transaction on Postgres

I recently got a "Out of shared memory - You might need to increase max_locks_per_transaction" error. This is a long running process where I import a bunch of CSV files after proper processing. I ...
1
vote
1answer
101 views

stored procedure vs. function in postgresql and which is better for executing dml statements

I'm using postgresql 9.3. If I want to add the following steps and call these steps as a routine, would it be better to use a function or stored procedure? My basic steps are: RENAME TABLE ...
1
vote
2answers
27 views

Migrating PostgreSQL files to new server

We have a Win 2008 server that went down because of cpu failure. We were running parts of the Atlassian stack (JIRA, Confluence, Stash, and Bamboo) on it using PostgreSQL as the database. I now have ...
1
vote
1answer
51 views

Update staging data with production data in Postgresql

I'm using PostgreSQL (version 9.3) on my server and I want to update the data in my staging instance database with the data in my production instance database. Each database is controlled by a ...
1
vote
1answer
52 views

Does VACUUM FULL need ANALYZE

I'd be grateful for some insight into the VACUUM functionality within PostgreSQL 9.3. I read through the documentation and searched around a bit but could not find a definitive answer to this. I'm ...
2
votes
1answer
50 views

postgresql - how and why indexes are bigger than their tables

I'm using postgresql 9.3 and trying to understand how and why indexes are bigger than their tables. Sample output: database_name | database_size | table_name ...
0
votes
1answer
31 views

What happens when a CTE query is interrupted

I have the following query. WITH d_rows AS (DELETE FROM t_a RETURNING * ) INSERT INTO t_b SELECT * FROM d_rows; What will happen if i cancel this query (Ctrl+c in psql)? Will the delete run? Does ...
0
votes
1answer
28 views

Backup-strategy for redundant data in postgresql-db.

I have a (postgresql-9.3)-table that contains images as a bytea-column as well as several other columns that contain extracted information from these images. (Some feature points, descriptors). These ...
3
votes
3answers
44 views

PostgreSQL GRANT ALL on mutliple tables using LIKE

I have more than 100 tables named public.test_* How can I easily GRANT ALL access to the user test to all that tables at once? I tried with: GRANT ALL ON TABLE public.test_* TO test; But it is ...
2
votes
1answer
69 views

Best index for similarity function

So I have this table with 6.2 millions records and I have to perform search queries with similarity for one for the column. The queries can be: SELECT "lca_test".* FROM "lca_test" WHERE ...
2
votes
3answers
111 views

How to prevent a PostgreSQL trigger from being fired by another trigger?

I have 2 triggers on one table; one works for INSERTs : CREATE TRIGGER "get_user_name" AFTER INSERT ON "field_data" FOR EACH ROW EXECUTE PROCEDURE "add_info"(); This updates some values in the ...
0
votes
0answers
38 views

Sync offline database with online

I have a rails application which is currently running on cloud. We want to serve our application to rural locations where Internet is not available. We will be deploying our rails application on local ...
1
vote
0answers
48 views

What is the best way to clear couple of tables each night at specific hour in Postgres SQL?

I need to clear couple of tables every night on my db so in the morning they will be empty and ready to use for the end users. I already wrote the query to truncate them but I'm not sure what is the ...
0
votes
1answer
18 views

Select row if column data was not selected

How can I selected rows from a table when a column data is different. Table: id(pk), name, title, book_id, date I want to get all the rows where book_id is uniq. Data example: test1, test2, 1, ...
-1
votes
1answer
37 views

how to aggregate time and data correspondingly using SQL?

I want to aggregate the time series and the data under each time series, the table I have now is: 00:00,00:15,location_1,300 00:00,00:15,location_2,240 00:15,00:30,location_1,100 ...
2
votes
0answers
65 views

Postgresql upgrade issue

I'm trying to test the Postgresql 9.3 -> 9.4 upgrade process on the development environment on windows and I get weird issue during the pg_upgrade invocation: PS D:\bin\postgres-9.4> ...
3
votes
1answer
61 views

Local Backup from Amazon RDS PostgreSQL database

I have a PostgreSQL database on an Amazon RDS instance. I want to have a local dump of this instance. So far, I've tried with this: PGPASSWORD="Password" pg_dump -h ...
0
votes
1answer
64 views

Adding elements into PostgreSQL json array field

I have table where one of the fields is JSON array. I need to append received JSON array into that field without overriding existing values. Something like that: CREATE OR REPLACE FUNCTION ...
0
votes
2answers
28 views

Table constraint, number of row taken by a fk key

Is it posible to add a table constraint, to prevent an insert if there are already 3 row of the same fk key My table: ProjectTitles (id(pk), project_id(fk), title_id(fk)) Check if project_id has ...
0
votes
0answers
21 views

doing a insert while selecting an specific user

I'm importing and legacy database to a new database, and changing data format. In this legacy database, I have data as following: Interaction id: 5458d717cd07870859000004 user_id: ...
0
votes
0answers
38 views

Why postgresql pg_dump exports a view as a table?

I am using postgresql 9.3 pg_dump tool for extracting only the public schema definition using: pg_dump -s -n public -h host -U postgres --dbname=db > ./schema.sql but when I check schema.sql one ...
1
vote
0answers
50 views

Master/Slave - streaming replication restrict function to master

How can I run a function a on master only? I don't want to connect directly to my master server, because the master server might change. Or can I change my function to work on this setup? Because ...
0
votes
0answers
23 views

PostgreSQL updates hang when two servers involved

I have an update statement that works fine when only a single server is involved, but never completes when it comes from two servers. I'm connecting with JDBC 9.1-902 to a 9.3 database on CentOS 6.6. ...
1
vote
1answer
127 views

Could not connect to postgres after installing 9.4 and uninstalling 9.3

I have installed postgresql 9.4 and I removed postgresql 9.3 from my computer. Now when I try to run: foo@bar:~$ psql I get the error psql: could not connect to server: No such file or directory ...
0
votes
0answers
14 views

Unable to import database through osm2pgrouting

I am very frustrated by the following errors while trying to import NewDelhi by osm2pgrouting tool: osm2pgrouting -file "/home/user/Downloads/new-delhi_india.osm" -conf ...
1
vote
1answer
53 views

Reduce the number of queries to the same table

I need to build some reports using two tables: AuthorTitles: id(pk), author_id, title_id AuthorReports: id(pk), author_id, title_id, items_sold, date My report needs to output the fallowing: ...
1
vote
1answer
118 views

Implementing json_object_agg() in Postgres 9.3

I feel like I need the json_object_agg() function of Postgres 9.4 but I will not be able to upgrade from 9.3 right now. Is there a way to do what I want in 9.3? Here's my scenario. I have a table ...
4
votes
2answers
125 views

Optimizing queries on a range of timestamps (one column)

I am using Postgres 9.3 through Heroku. I have a table, "traffic", with 1M+ records that has many inserts and updates every day. I need to perform SUM operations across this table over different time ...
0
votes
0answers
33 views

PostgreSQL - Calculating opening and closing balances

I am having the following scenario some time right after midnight I'd like to calculate was the closing balances were for the day before and the opening balances for the current day. Those two values ...
2
votes
2answers
28 views

Aggregate all joined rows with where clause

Three nested tables exist: user_groups, users, projects. Each user_group has many users and, in turn, each user has many projects. Each project has an ordinal assigned, 1-5 (step_number). I would ...