Re: [PERFORM] WAL partition filling up after high WAL activity

2011-11-11 Thread Greg Smith
On 11/11/2011 04:54 AM, Rafael Martinez wrote: Your explanation in 2) sounds like a good candidate for the problem we had. As I said in june, I think we need to improve the documentation in this area. A note in the documentation about what you have explained in 2) with maybe some hints about how

[PERFORM] Using incrond for archiving

2011-11-11 Thread Shaun Thomas
Hey guys, I've been running some tests while setting up some tiered storage, and I noticed something. Even having an empty 'echo' as archive_command drastically slows down certain operations. For instance: => ALTER TABLE foo SET TABLESPACE slow_tier; ALTER TABLE Time: 3969.962 ms When I set

Re: [PERFORM] unlogged tables

2011-11-11 Thread Stephen Frost
* Anibal David Acosta (a...@devshock.com) wrote: > Unlogged tables are not memory tables don't? Unlogged tables are not memory tables. > If we stop postgres server (normal stop) and start again, all information in > unlogged tables still remain? Yes. > So, can I expect a data loss just in case

[PERFORM] unlogged tables

2011-11-11 Thread Anibal David Acosta
Hello, just for clarification. Unlogged tables are not memory tables don't? If we stop postgres server (normal stop) and start again, all information in unlogged tables still remain? So, can I expect a data loss just in case of crash, power failure or SO crash don't? In case of cras

Re: [PERFORM] where clause + function, execution order

2011-11-11 Thread Richard Huxton
On 11/11/11 16:28, Sorin Dudui wrote: Hi, this is the EXPLAIN ANALYSE output: "Merge Left Join (cost=0.00..2820.34 rows=23138 width=777) (actual time=0.049..317.935 rows=26809 loops=1)" " Merge Cond: ((a.admin10)::text = (b.link_id)::text)" " -> Index Scan using admin_lookup_admin10 on a

Re: [PERFORM] avoiding seq scans when two columns are very correlated

2011-11-11 Thread Ruslan Zakirov
On Fri, Nov 11, 2011 at 7:36 PM, Tom Lane wrote: > Ruslan Zakirov writes: >> A table has two columns id and EffectiveId. First is primary key. >> EffectiveId is almost always equal to id (95%) unless records are >> merged. Many queries have id = EffectiveId condition. Both columns are >> very dis

Re: [PERFORM] where clause + function, execution order

2011-11-11 Thread Sorin Dudui
Hi, this is the EXPLAIN ANALYSE output: "Merge Left Join (cost=0.00..2820.34 rows=23138 width=777) (actual time=0.049..317.935 rows=26809 loops=1)" " Merge Cond: ((a.admin10)::text = (b.link_id)::text)" " -> Index Scan using admin_lookup_admin10 on admin_lookup a (cost=0.00..845.04 rows=5

Re: [PERFORM] where clause + function, execution order

2011-11-11 Thread Tom Lane
Sorin Dudui writes: > I am wondering when the where clause (a.x = 'value') is executed. After the > select statement in the function finishes? Or is it appended at the select > statement in the function? EXPLAIN is your friend ... In this case the function looks inline-able, so reasonably rece

Re: [PERFORM] where clause + function, execution order

2011-11-11 Thread Richard Huxton
On 11/11/11 15:54, Julius Tuskenis wrote: On 2011.11.11 17:38, Sorin Dudui wrote: I have the following function: CREATE OR REPLACE FUNCTION xxx(text) [snip] LANGUAGE sql STABLE Function execute plan is prepared when creating it, so the "where" clause should check the function result not al

Re: [PERFORM] where clause + function, execution order

2011-11-11 Thread Julius Tuskenis
Hello, On 2011.11.11 17:38, Sorin Dudui wrote: Hi, I have the following function: === CREATE OR REPLACE FUNCTION xxx(text) RETURNS SETOF v AS $BODY$ select a.x, a.y, CASE WHEN strpos($1,b.x) > 0 THEN b.x ELSE NULL END AS mp_hm fr

[PERFORM] where clause + function, execution order

2011-11-11 Thread Sorin Dudui
Hi, I have the following function: === CREATE OR REPLACE FUNCTION xxx(text) RETURNS SETOF v AS $BODY$ select a.x, a.y, CASE WHEN strpos($1,b.x) > 0 THEN b.x ELSE NULL END AS mp_hm from a LEFT JOIN b ON a.id=b.id $BODY$ LAN

Re: [PERFORM] avoiding seq scans when two columns are very correlated

2011-11-11 Thread Tom Lane
Ruslan Zakirov writes: > A table has two columns id and EffectiveId. First is primary key. > EffectiveId is almost always equal to id (95%) unless records are > merged. Many queries have id = EffectiveId condition. Both columns are > very distinct and Pg reasonably decides that condition has very

[PERFORM] avoiding seq scans when two columns are very correlated

2011-11-11 Thread Ruslan Zakirov
Hello, A table has two columns id and EffectiveId. First is primary key. EffectiveId is almost always equal to id (95%) unless records are merged. Many queries have id = EffectiveId condition. Both columns are very distinct and Pg reasonably decides that condition has very low selectivity and pick

Re: [PERFORM] WAL partition filling up after high WAL activity

2011-11-11 Thread Rafael Martinez
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/09/2011 05:06 PM, Greg Smith wrote: > On 11/07/2011 05:18 PM, Richard Yen wrote: >> My biggest question is: we know from the docs that there should be no >> more than (2 + checkpoint_completion_target) * checkpoint_segments + 1 >> files. For us,

Re: [PERFORM] Heavy contgnous load

2011-11-11 Thread kzsolt
Looks like I found more magic. My table is: each record near 1kbyte, contain dozen col some text some numeric, some of the numeric columns are indexed. The database located at ramdisk (tmpfs) ((I hope)). The table is contignously filled with rows. If the table has less than 4Mrec then looks like