[GENERAL] SELECT 'NOW()' - OK, SELECT 'CLOCK_TIMESTAMP()' - ERROR

2014-08-21 Thread Piotr Gasidło
Hello, I found strange PostgreSQL 9.3 behavior: > select now()::timestamp, 'now()'::timestamp; now | timestamp + 2014-08-22 08:34:00.883268 | 2014-08-22 08:34:00.883268 Second column is now() in single apost

Re: [GENERAL] hot_standby_feedback vs. max_standby_archive_delay/max_standby_streaming_delay?

2014-08-21 Thread Steve Kehlet
Thank you for the guidance! So far so good with max_standby_archive/streaming_delay, no cancellations.

[GENERAL] Use of 'now' constant datatype in view to take advantage of partitioned table

2014-08-21 Thread Patrick Dung
Hi Postgresql users, I have a master table with two partition table (food_2013p, food_2014p). I found that when I use SELECT + 'now' constant, constraint exclusion works, (it skipped the 2013 partition). EXPLAIN ANALYZE  SELECT *    FROM food  WHERE food.post_timestamp >= ('now'::date - interva

Re: [GENERAL] Use of 'now' constant datatype in view to take advantage of partitioned table

2014-08-21 Thread Patrick Dung
Hi Ken, Thanks for reply. 1. The problem is that using 'now' in VIEW, the resulting VIEW will hard code the current timestamp. It is not dynamic. If I use write the view like this:  WHERE food.post_timestamp >= ('now'::date - interval '1 month')::timestamp without time zone  AND food.post_time

Re: [GENERAL] hot_standby_feedback vs. max_standby_archive_delay/max_standby_streaming_delay?

2014-08-21 Thread Alvaro Herrera
Steve Kehlet wrote: > Our queries on our Standby are getting cancelled and so we're investigating > how to prevent this. The standby is for running periodic reporting queries > only, we don't care if it falls behind a little bit, we just set this guy > up to reduce the load on the Primary. > > Whi

Re: [GENERAL] hot_standby_feedback vs. max_standby_archive_delay/max_standby_streaming_delay?

2014-08-21 Thread John R Pierce
On 8/21/2014 1:44 PM, Steve Kehlet wrote: Our queries on our Standby are getting cancelled and so we're investigating how to prevent this. The standby is for running periodic reporting queries only, we don't care if it falls behind a little bit, we just set this guy up to reduce the load on the

Re: [GENERAL] hot_standby_feedback vs. max_standby_archive_delay/max_standby_streaming_delay?

2014-08-21 Thread Shaun Thomas
On 08/21/2014 03:44 PM, Steve Kehlet wrote: So we're going to try applying max_standby_archive_delay and max_standby_streaming_delay to 1h or so. We're also looking at pg_xlog_replay_pause(), although this is less desirable because we don't want to have to ask the people running reports to remem

[GENERAL] hot_standby_feedback vs. max_standby_archive_delay/max_standby_streaming_delay?

2014-08-21 Thread Steve Kehlet
Our queries on our Standby are getting cancelled and so we're investigating how to prevent this. The standby is for running periodic reporting queries only, we don't care if it falls behind a little bit, we just set this guy up to reduce the load on the Primary. While researching there appear to b

Re: [GENERAL] Does writing new records while massive update will generate lock ?

2014-08-21 Thread Alban Hertroys
On 21 August 2014 15:41, Victor d'Agostino wrote: > I'm updating this column (for more than 48 hours now) on a RAID5 server. > RAID5? That's probably the worst performing RAID configuration you can have and is usually advised against on this list. You would be better off with RAID 10, RAID 1+0

Re: [GENERAL] Does writing new records while massive update will generate lock ?

2014-08-21 Thread Raymond O'Donnell
On 21/08/2014 14:41, Victor d'Agostino wrote: > Hi everybody, > > I added a datetime column to a table with 51.10^6 entries. > > ALTER TABLE MYBIGTABLE ADD COLUMN date timestamp without time zone; > > I'm updating this column (for more than 48 hours now) on a RAID5 > server. > > UPDATE MYBIGTAB

Re: [GENERAL] Does writing new records while massive update will generate lock ?

2014-08-21 Thread Shaun Thomas
On 08/21/2014 08:41 AM, Victor d'Agostino wrote: UPDATE MYBIGTABLE SET date = (SELECT date FROM INDEXEDTABLE WHERE INDEXEDTABLE.email_id=MYBIGTABLE.email_id) WHERE date is null; I may be wrong here, but wouldn't this style of query force a nested loop? Over several million rows, that would ta

[GENERAL] Does writing new records while massive update will generate lock ?

2014-08-21 Thread Victor d'Agostino
Hi everybody, I added a datetime column to a table with 51.10^6 entries. ALTER TABLE MYBIGTABLE ADD COLUMN date timestamp without time zone; I'm updating this column (for more than 48 hours now) on a RAID5 server. UPDATE MYBIGTABLE SET date = (SELECT date FROM INDEXEDTABLE WHERE INDEXEDTABLE

Re: [GENERAL] Use of 'now' constant datatype in view to take advantage of partitioned table

2014-08-21 Thread Patrick Dung
Hi all, I got a typo in last mail, below is the updated one, with changes in bold fonts. The method is inspired by Date LastDay - PostgreSQL wiki             Date LastDay - PostgreSQL wiki Snippets Date LastDay() Works with PostgreSQL Any version Written in SQL Depends on Nothing by Scott Bai

Re: [GENERAL] Use of 'now' constant datatype in view to take advantage of partitioned table

2014-08-21 Thread Ken Tanzer
> EXPLAIN ANALYZE > SELECT * >FROM food > WHERE food.post_timestamp >= ('now'::date - interval '1 month')::date AND > food.post_timestamp <= 'now' > ORDER BY food.post_timestamp DESC > LIMIT 30; I think the problem is that you're using 'now'::date in your first example, which gets froz

Re: [GENERAL] Use of 'now' constant datatype in view to take advantage of partitioned table

2014-08-21 Thread Patrick Dung
An update, inspired by Date LastDay - PostgreSQL wiki             Date LastDay - PostgreSQL wiki Snippets Date LastDay() Works with PostgreSQL Any version Written in SQL Depends on Nothing by Scott Bailey 'Artacus' View on wiki.postgresql.org Preview by Yahoo   1. Create a function like:

Re: [GENERAL] Use of 'now' constant datatype in view to take advantage of partitioned table

2014-08-21 Thread Patrick Dung
Resent. As I could not see my mail in the mailing list after about two hours. On Thursday, August 21, 2014 1:43 PM, Patrick Dung wrote: Hi Postgresql users, I have a master table with two partition table (food_2013p, food_2014p). I found that when I use SELECT + 'now' constant, constrain