Re: [GENERAL] How to safely compare transaction id?

2008-01-13 Thread alphax
Tom Lane wrote: > alphax <[EMAIL PROTECTED]> writes: >> So, it seems the system column "cmin" is the logical "current version" >> of that record, isn't it? > > No. Have you read > http://www.postgresql.org/docs/8.2/static/ddl-system-columns.html > Yes, I do. But I don't understand the actual mean

Re: [GENERAL] query performance

2008-01-13 Thread Alex Turner
Oh - if you do this then make sure that you have the primary key index on overview too. Alex On Jan 14, 2008 12:53 AM, Alex Turner <[EMAIL PROTECTED]> wrote: > If you combine it with Tom Lane's suggestion - it will go even better, > something like: > > select * from t_documentcontent where _id i

Re: [GENERAL] 8.2.4 serious slowdown

2008-01-13 Thread Sim Zacks
Apparently I was suffering from brain freeze. sim Lew wrote: (attribution restored) Clodoaldo wrote: > I don't know if the plan would be the same but this is a bit clearer: > > WHERE COALESCE(b.quantity, 0) > COALESCE(b.deliveredsum, 0) Sim Zacks wrote: That should be true, but sometimes w

Re: [GENERAL] query performance

2008-01-13 Thread Alex Turner
If you combine it with Tom Lane's suggestion - it will go even better, something like: select * from t_documentcontent where _id in (select _id from overview where _id>x order by _id limit 50); Alex On Jan 13, 2008 11:59 PM, pepone. onrez <[EMAIL PROTECTED]> wrote: > > Thanks Alex > > I test yo

Re: [GENERAL] query performance

2008-01-13 Thread pepone . onrez
Thanks Alex I test your solution and is realy more faster. Nested Loop (cost=1743.31..2044.58 rows=50 width=908) (actual time= 101.695..106.178 rows=50 loops=1) -> HashAggregate (cost=1743.31..1743.31 rows=50 width=108) (actual time= 101.509..101.567 rows=50 loops=1) -> Subquery Sca

Re: [GENERAL] query performance

2008-01-13 Thread Alex Turner
Here is a table I threw together to demonstrate the approximate speed of a materialized view in this case: trend=# explain analyze select property_id from overview order by property_id limit 50 offset 5; QUERY PLAN --

Re: [GENERAL] query performance

2008-01-13 Thread Alex Turner
If you have to access the data this way (with no where clause at all - which sometimes you do) then I have already provided a solution that will work reasonably well. If you create what is essentially a materialized view of just the id field, the sequence scan will return much fewer pages than whe

Re: [GENERAL] query performance

2008-01-13 Thread pepone . onrez
Sorry Alex i forget mention that i have setscan of in my last test. now I have set seqscan on and indexscan on and added order by _id The table has an index in the _id field CREATE INDEX i_documentcontent_document ON t_documentcontent USING btree (_document); The database was rencently v

Re: [GENERAL] query performance

2008-01-13 Thread Tom Lane
"Scott Marlowe" <[EMAIL PROTECTED]> writes: > On Jan 13, 2008 8:58 PM, pepone. onrez <[EMAIL PROTECTED]> wrote: >> t_documentcontent._id AS _id >> FROM t_documentcontent LIMIT 50 OFFSET 8 > with no order by, and possibly no index on t_documentcontent._id, > there's no choice but a seq scan. M

Re: [GENERAL] query performance

2008-01-13 Thread Scott Marlowe
On Jan 13, 2008 8:58 PM, pepone. onrez <[EMAIL PROTECTED]> wrote: > I have this query in a table with 150 thowsand tuples and it takes to long > > t_documentcontent._id AS _id > FROM t_documentcontent LIMIT 50 OFFSET 8 > > here is the explain output > > "Limit (cost= 100058762.30..1000

Re: [GENERAL] query performance

2008-01-13 Thread Alex Turner
If you haven't already, make sure you've done a vacuum full recently. When in doubt, pg_dump the db, and reload it, and see if that helps, but this works for me: create table overview as select _id from t_documentcontent; alter table overview add constraint overview_pkey primary key (_id); selec

[GENERAL] query performance

2008-01-13 Thread pepone . onrez
I have this query in a table with 150 thowsand tuples and it takes to long t_documentcontent._id AS _id FROM t_documentcontent LIMIT 50 OFFSET 8 here is the explain output "Limit (cost=100058762.30..100058799.02 rows=50 width=58) (actual time= 19433.474..19433.680 rows=50 loops=1)"

Re: [GENERAL] What pg_restore does to a non-empty target database

2008-01-13 Thread Tom Lane
"Ken Winter" <[EMAIL PROTECTED]> writes: > I need to understand, in as much detail as possible, the results that will > occur when pg_restore restores from an archive file into a target database > that already contains some database objects. I can't find any reference > that spells this out. (The

Re: [GENERAL] How to safely compare transaction id?

2008-01-13 Thread Trevor Talbot
On 1/11/08, alphax <[EMAIL PROTECTED]> wrote: > I want to determines a given record which visible to current transaction > whether or not be updated after some time point, that time point is > indicated by aother transaction id started and committed in past time. I'm not sure I understand, but ma

[GENERAL] What pg_restore does to a non-empty target database

2008-01-13 Thread Ken Winter
I need to understand, in as much detail as possible, the results that will occur when pg_restore restores from an archive file into a target database that already contains some database objects. I can't find any reference that spells this out. (The PG manual isn't specific enough.) Instead of ju

Re: [GENERAL] tsearch2 install on Fedora Core 5 problems

2008-01-13 Thread Tom Lane
"Satch Jones" <[EMAIL PROTECTED]> writes: > Hello - I can't get tsearch2 running in a long-functioning instance of > PostgreSQL 8.1.9 on Fedora Core 5, and could use some help. Rather than trying to compile it yourself, why don't you just install the postgresql-contrib RPM that goes with the postg

[GENERAL] tsearch2 install on Fedora Core 5 problems

2008-01-13 Thread Satch Jones
Hello - I can't get tsearch2 running in a long-functioning instance of PostgreSQL 8.1.9 on Fedora Core 5, and could use some help. When I place the tsearch2 source files under the contrib folder in a standard Fedora Core 5 postgres install (/usr/share/pgsql/contrib) and run make, I get the foll

[GENERAL] Satisfactory Query Time

2008-01-13 Thread x asasaxax
Hi, I have a query that takes 0.450 ms. Its a xml query. Is that a good time for a query? If a have multiple connections on the database, will this time makes my db slow? How much time is good for a xml query? Thanks

Re: [GENERAL] tcp_keepalives_idle ignored

2008-01-13 Thread henry
On Sun, January 13, 2008 7:25 pm, Tom Lane wrote: > Martijn van Oosterhout <[EMAIL PROTECTED]> writes: >> On Sun, Jan 13, 2008 at 08:40:34AM +0200, henry wrote: >>> lsof doesn't tell me what's talking to PG through /tmp/.s.PGSQL.5432 >>> either. Maybe I'm not understanding exactly how /tmp/.s.PG

Re: [GENERAL] How to safely compare transaction id?

2008-01-13 Thread Tom Lane
alphax <[EMAIL PROTECTED]> writes: > So, it seems the system column "cmin" is the logical "current version" > of that record, isn't it? No. Have you read http://www.postgresql.org/docs/8.2/static/ddl-system-columns.html regards, tom lane ---(end

Re: [GENERAL] tcp_keepalives_idle ignored

2008-01-13 Thread Tom Lane
Martijn van Oosterhout <[EMAIL PROTECTED]> writes: > On Sun, Jan 13, 2008 at 08:40:34AM +0200, henry wrote: >> lsof doesn't tell me what's talking to PG through /tmp/.s.PGSQL.5432 >> either. Maybe I'm not understanding exactly how /tmp/.s.PGSQL.5432 is >> used - what would connect to PG via a doma

Re: [GENERAL] ECPG problem with 8.3

2008-01-13 Thread Peter Wilson
Michael Meskes wrote: On Fri, Jan 11, 2008 at 11:51:08PM +, Peter Wilson wrote: I've just tried compiling our project against the 8.3RC1 code. This is the first time I've tried any release of 8.3. ... crbembsql.pgC:254: error: invalid conversion from `int' to `ECPG_statement_type' crbembsql

Re: [GENERAL] ECPG problem with 8.3

2008-01-13 Thread Michael Meskes
On Fri, Jan 11, 2008 at 11:51:08PM +, Peter Wilson wrote: > I've just tried compiling our project against the 8.3RC1 code. This is > the first time I've tried any release of 8.3. > ... > crbembsql.pgC:254: error: invalid conversion from `int' to > `ECPG_statement_type' > crbembsql.pgC:254: er

Re: [GENERAL] How to safely compare transaction id?

2008-01-13 Thread alphax
Marko Kreen wroted: By the way, Can I think that the value of system column "ctid" of an record is the logical "current version" of that record, and used to compare with txid returned by "FUNCTIONS-TXID-SNAPSHOT"? No, it is just physical location of the row. Thanks, I just done some sim

Re: [GENERAL] tcp_keepalives_idle ignored

2008-01-13 Thread Martijn van Oosterhout
On Sun, Jan 13, 2008 at 08:40:34AM +0200, henry wrote: > > This is all irrelevant to your real problem, to judge by the rest of > > the thread, but I'm curious. > > I did in fact find a leak in long-lived procs (some of which can run for > days) - but squashing that did not make my problem go away

Re: [GENERAL] 8.2.4 serious slowdown

2008-01-13 Thread Sim Zacks
> I don't know if the plan would be the same but this is a bit clearer: > > WHERE COALESCE(b.quantity, 0) > COALESCE(b.deliveredsum, 0) That should be true, but sometimes we get deliveries of greater quantity then we ordered. I just want to know the times when I haven't gotten the complete order

Re: [GENERAL] 8.2.4 serious slowdown

2008-01-13 Thread Clodoaldo
2008/1/13, Sim Zacks <[EMAIL PROTECTED]>: > How would you rewrite something like: >WHERE (COALESCE(b.quantity, 0) - COALESCE(b.deliveredsum, 0)) > 0; > I could write: > where case when b.quantity is null then 0 else b.quantity end - case when > b.deliveredsum is null then 0 else b.deliveredsum

Re: [GENERAL] tcp_keepalives_idle ignored

2008-01-13 Thread henry
On Sat, January 12, 2008 6:50 pm, Tom Lane wrote: > "henry" <[EMAIL PROTECTED]> writes: >> I have tried setting tcp_keepalives_idle = 120 (eg), then restarting PG, >> but SHOW ALL; shows tcp_keepalives_idle=0 (ignoring my setting). > > Just FYI, this is the expected behavior on platforms where th