[GENERAL] "Tardis" approach for history tables

2016-03-18 Thread Iván Perdomo
Hi all, I'm trying to follow Magnus Hagander's [1] approach for having a history tables. Basically having a copy of the schema table in a `history` schema, plus an extra time range column for the validity period of a row. I made a basic setup [2] and the version logging part is working "as expect

Re: [GENERAL] ON CONFLICT DO NOTHING RETURNING

2016-03-18 Thread Peter Geoghegan
On Fri, Mar 18, 2016 at 9:14 AM, Jeff Janes wrote: > He wants to retrieve a value from the conflicting row. Now getting > the value that caused the conflict should be easy, because you > provided it in the first place. But he wants a value from a > different column of the conflicting row than t

Re: [GENERAL] Drop only temporary table

2016-03-18 Thread Tom Lane
Durumdara writes: > As I experienced I can create normal and temp table with same name. Sure. > As I see that drop table stmt don't have "temporary" suboption to determine > which to need to eliminate - the real or the temporary. Once you've created a temp table, it masks any normal table of th

Re: [GENERAL] Confusing deadlock report

2016-03-18 Thread Albe Laurenz
Thomas Kellerer wrote: > we have a strange (at least to me) deadlock situation which does not seem to > fall into the "usual" > deadlock category. > > The error as reported in the Postgres log file is this: > > 2016-03-12 13:51:29.305 CET [23912]: [1-1] user=arthur,db=prod,app=[unknown] > ERROR

[GENERAL] Schema Size - PostgreSQL 9.2

2016-03-18 Thread drum.lu...@gmail.com
Hi all, Can you please provide me a Query that tells me how much space is a Schema in my DB? I'm using one but don't think it's right > > SELECT schema_name, >pg_size_pretty(sum(table_size)::bigint), >(sum(table_size) / pg_database_size(current_database())) * 100 as a > FROM

Re: [HACKERS] [GENERAL] Request - repeat value of \pset title during \watch interations

2016-03-18 Thread Tom Lane
David Steele writes: > On 3/17/16 7:00 PM, Tom Lane wrote: >> The message I saw was post-1-March. If it was in fact submitted in >> time for 2016-03, then we owe it a review. > I meant to add the CF record and forgot: > https://commitfest.postgresql.org/9/480 > It was added 2016-01-13 by Michael

Re: [GENERAL] Insert data in two columns same table

2016-03-18 Thread Adrian Klaver
On 03/16/2016 07:07 PM, drum.lu...@gmail.com wrote: I see a lot of other problems: you have 3 independet tables. Your 2 queries (selects) returns 2 independet results, you can't use that for insert into the 3rd table. And i think, you are looking for an update, not insert.

Re: [GENERAL] Question about shared_buffer cache behavior

2016-03-18 Thread Rakesh Kumar
PG loads data at the block level to shared_buffers. Most likely it is because the second sql selects different set of rows (from different blocks) than the first sql. On Fri, Mar 18, 2016 at 4:24 PM, Paul Jones wrote: > In Postgres 9.5.1 with a shared_buffer cache of 7Gb, a SELECT from > a single

Re: [GENERAL] spurious /dev/shm related errors on insert

2016-03-18 Thread rob stone
On Fri, 2016-03-18 at 10:45 -0400, Michael Charnoky wrote: > I should have noted: the application is using PostgreSQL 9.5.0, > running on Ubuntu 14.04 > > Mike > > On Fri, Mar 18, 2016 at 10:41 AM, Michael Charnoky > wrote: > > Hi, I'm seeing random errors from an application that is performing

[GENERAL] Insert data in two columns same table

2016-03-18 Thread drum.lu...@gmail.com
I'm trying to insert data from TABLE A to TABLE B. 1 - Select billable_id from dm.billable 2 - Select mobiuser_id from ja_mobiusers 3 - Insert the billable_id and the mobiuser_id to the dm.billables_links table. *FYI -* It has to be in the same transaction because the mobiuser_id must go to the

[GENERAL] which db caused postgres to stop serving due to wraparound prevention?

2016-03-18 Thread Steve Kehlet
Sorry, seems like such a noob problem, but I'm stumped. This is postgres 9.4.5. I'll post my custom settings if desired but I don't think they're needed. We recently had an issue where the autovacuumer wasn't starting because postgres couldn't resolve the hostname 'localhost' (we had bad perms on

Re: [GENERAL] Confusing deadlock report

2016-03-18 Thread Albe Laurenz
Thomas Kellerer wrote: >> Can you determine what statements were executed in these transactions before >> the deadlock? >> It was probably one of these that took the conflicting lock. > > Unfortunately not. Statement logging is not enabled on that server > (space-constrained). > > And while we

Re: [GENERAL] Partition

2016-03-18 Thread Sándor Daku
On 18 March 2016 at 10:55, Leonardo M. Ramé wrote: > Hi, I have read and re-read the Partitioning chapter ( > http://www.postgresql.org/docs/9.1/static/ddl-partitioning.html), but I > still don't see how to implement this use case: > > One table storing current data, let's call it the "master tab

[GENERAL] Deleting schema - saving up space - PostgreSQL 9.2

2016-03-18 Thread drum.lu...@gmail.com
Hi all, I've got four servers: 1 - Master 2 - Slave Hot Standby (Same hardware) 3 - Slave Hot Standby (Same hardware) 4 - Slave Hot Standby (VM - Very slow machine) On the master server, I've got a schema named "GORFS" with 80 GB, according to this SQL: SELECT schema_name, >pg_size_pret

[GENERAL] Drop only temporary table

2016-03-18 Thread Durumdara
Dear PG Masters! As I experienced I can create normal and temp table with same name. create table x (kod integer); CREATE TEMPORARY TABLE x (kod integer); select tablename from pg_tables where schemaname='public' union all select c.relname from pg_class c join pg_namespace n on n.oid=c.relname

Re: [GENERAL] Request - repeat value of \pset title during \watch interations

2016-03-18 Thread David G. Johnston
On Thursday, March 17, 2016, Michael Paquier wrote: > On Fri, Mar 18, 2016 at 8:16 AM, Tom Lane > wrote: > > David Steele > writes: > >> On 3/17/16 7:00 PM, Tom Lane wrote: > >>> The message I saw was post-1-March. If it was in fact submitted in > >>> time for 2016-03, then we owe it a review.

Re: [GENERAL] Unique UUID value - PostgreSQL 9.2

2016-03-18 Thread drum.lu...@gmail.com
> > >> > SELECT ​'test_'​ || substring(uuid_generate_v4()::text, 1, 1); > > Or use a sequence, or just compute "ROW_NUMBER() OVER ()" and tack that on. > > David J. > ​ > > Well.. I was able to do it by using: > INSERT INTO dm.billables_links (billable_id) VALUES ((SELECT billable_id > FROM junk.w

Re: [GENERAL] Insert data in two columns same table

2016-03-18 Thread John R Pierce
On 3/16/2016 7:07 PM, drum.lu...@gmail.com wrote: *1 -* select the billable_id: (SELECT1) SELECT billable_id FROM junk.wm_260_billables2 WHERE info ilike '%Alisha%' *2 -* select the mobiuser_id: (SELECT2) SELECT id FROM public.ja_mobiusers WHERE name_first LIKE 'Alisha%' AND name_last LIKE 'Da