Re: [GENERAL] query planner weirdness?

2008-06-27 Thread Steve Atkins
On Jun 27, 2008, at 9:53 PM, Adam Rich wrote: "Bob Duffey" <[EMAIL PROTECTED]> writes: I'm seeing some query plans that I'm not expecting. The table in question is reasonably big (130,000,000 rows). The table has a primary key, indexed by one field ("ID", of type bigint). Thus, I wou

Re: [GENERAL] freebsd + postgresql 8.3.3 = 100% of cpu usage on stats collector?

2008-06-27 Thread Rodrigo Gonzalez
hubert depesz lubaczewski wrote: > On Fri, Jun 27, 2008 at 06:37:45PM -0400, Bill Moran wrote: >> Just in case you're not a FreeBSD expert, it's ktrace on FreeBSD. strace >> is the Linux equivalent. > > i'm not an freebsd expert. > > i ran ktrace -p - it exited immediately. > then i ran ktrace

Re: [GENERAL] Advice Wanted on Selecting Multi-row Data Requests in 10-Row Blocks

2008-06-27 Thread Craig Ringer
Bill Thoen wrote: What I'm wondering is how in PostgreSQL do you select only the first 10 records from a selection, then the next 10, then the next, and possibly go back to a previous 10? LIMIT with OFFSET has already been mentioned. There's another option if your web app is backed by an app

Re: [GENERAL] query planner weirdness?

2008-06-27 Thread Bob Duffey
2008/6/28 Adam Rich <[EMAIL PROTECTED]>: > > > This is not wrong, or at least not obviously wrong. A full-table > > indexscan is often slower than seqscan-and-sort. If the particular > > case is wrong for you, you need to look at adjusting the planner's > > cost parameters to match your environm

Re: [GENERAL] query planner weirdness?

2008-06-27 Thread Adam Rich
> > "Bob Duffey" <[EMAIL PROTECTED]> writes: > > I'm seeing some query plans that I'm not expecting. The table in > question > > is reasonably big (130,000,000 rows). The table has a primary key, > indexed > > by one field ("ID", of type bigint). Thus, I would expect the > following > > query

Re: [GENERAL] query planner weirdness?

2008-06-27 Thread Bob Duffey
2008/6/28 Tom Lane <[EMAIL PROTECTED]>: > "Bob Duffey" <[EMAIL PROTECTED]> writes: > > I'm seeing some query plans that I'm not expecting. The table in > question > > is reasonably big (130,000,000 rows). The table has a primary key, > indexed > > by one field ("ID", of type bigint). Thus, I wo

Re: [GENERAL] freebsd + postgresql 8.3.3 = 100% of cpu usage on stats collector?

2008-06-27 Thread hubert depesz lubaczewski
On Fri, Jun 27, 2008 at 06:37:45PM -0400, Bill Moran wrote: > Just in case you're not a FreeBSD expert, it's ktrace on FreeBSD. strace > is the Linux equivalent. i'm not an freebsd expert. i ran ktrace -p - it exited immediately. then i ran ktrace -p -f stats.ktrace.log -t\+ and it also exited

Re: [GENERAL] query planner weirdness?

2008-06-27 Thread Tom Lane
"Bob Duffey" <[EMAIL PROTECTED]> writes: > I'm seeing some query plans that I'm not expecting. The table in question > is reasonably big (130,000,000 rows). The table has a primary key, indexed > by one field ("ID", of type bigint). Thus, I would expect the following > query to simply scan throu

[GENERAL] query planner weirdness?

2008-06-27 Thread Bob Duffey
Hi, I'm seeing some query plans that I'm not expecting. The table in question is reasonably big (130,000,000 rows). The table has a primary key, indexed by one field ("ID", of type bigint). Thus, I would expect the following query to simply scan through the table using the primary key: select

Re: [GENERAL] freebsd + postgresql 8.3.3 = 100% of cpu usage on stats collector?

2008-06-27 Thread Bill Moran
On Fri, 27 Jun 2008 18:04:19 -0400 Tom Lane <[EMAIL PROTECTED]> wrote: > hubert depesz lubaczewski <[EMAIL PROTECTED]> writes: > > friend asked me to setup replication on their machines, and i noticed > > that one of cpus (2 quad xeons) is used to 100%: > > pgsql 58241 99.0 0.2 22456 7432 ??

Re: [GENERAL] freebsd + postgresql 8.3.3 = 100% of cpu usage on stats collector?

2008-06-27 Thread Tom Lane
hubert depesz lubaczewski <[EMAIL PROTECTED]> writes: > friend asked me to setup replication on their machines, and i noticed > that one of cpus (2 quad xeons) is used to 100%: > pgsql 58241 99.0 0.2 22456 7432 ?? Rs Thu10AM 1530:35.93 postgres: > stats collector process(postgres) Hmm,

Re: [GENERAL] problem getting postgres 8.3.1 with xml support to work on Redhat Enterprise Linux 4

2008-06-27 Thread Tom Lane
"Aswani Kumar" <[EMAIL PROTECTED]> writes: > The Postgres was built using ./configure > XML2_CONFIG=/usr/local/libxml/bin/xml2-config > --prefix=/usr/local/postgresql-8.3.1 --with-libxml. Libxml2-2.6.32 was > built using ./configure --prefix=/usr/local/libxml and is the location > pointed to in t

Re: [GENERAL] Advice Wanted on Selecting Multi-row Data Requests in 10-Row Blocks

2008-06-27 Thread Richard Broersma
On Fri, Jun 27, 2008 at 2:09 PM, Bill Thoen <[EMAIL PROTECTED]> wrote: > Thanks for tip on OFFSET. That's just what I needed. It's so easy when you > know the command you're looking for, and so hard when you know what you want > to do but don't know what the command is called! I would strongly sug

Re: [GENERAL] Advice Wanted on Selecting Multi-row Data Requests in 10-Row Blocks

2008-06-27 Thread Bill Thoen
Thanks for tip on OFFSET. That's just what I needed. It's so easy when you know the command you're looking for, and so hard when you know what you want to do but don't know what the command is called! Thanks, - Bill Thoen -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To

Re: [GENERAL] Advice Wanted on Selecting Multi-row Data Requests in 10-Row Blocks

2008-06-27 Thread Ragnar
Hello apart from the increasing OFFSET method, you only need to traverse the results sequentially, you can do a variant of this: let us assume your resultset has a a unique column pk, and is ordered on column o: initial select: select * from foo order by o limit 10; next page select * from

Re: [GENERAL] Advice Wanted on Selecting Multi-row Data Requests in 10-Row Blocks

2008-06-27 Thread Olexandr Melnyk
On 6/27/08, Bill Thoen <[EMAIL PROTECTED]> wrote: > > What I want to do is present the results of a query in a web page, but only > 10 rows at a time. My PostgreSQL table has millions of records and if I > don't add a LIMIT 10 to the SQL selection, the request can take too long. > The worst case sc

Re: [GENERAL] Advice Wanted on Selecting Multi-row Data Requests in 10-Row Blocks

2008-06-27 Thread Lennin Caro
use a dynamic select in the web page $1 = 10 $2 = 5 select * from mytable limit $1 OFFSET $2 --- On Fri, 6/27/08, Bill Thoen <[EMAIL PROTECTED]> wrote: From: Bill Thoen <[EMAIL PROTECTED]> Subject: [GENERAL] Advice Wanted on Selecting Multi-row Data Requests in 10-Row Blocks To: pgsql-general@p

Re: [GENERAL] Advice Wanted on Selecting Multi-row Data Requests in 10-Row Blocks

2008-06-27 Thread Adam Rich
> > What I want to do is present the results of a query in a web page, but > only 10 rows at a time. My PostgreSQL table has millions of records and > if I don't add a LIMIT 10 to the SQL selection, the request can take > too > long. The worst case scenario is when the user requests all records >

[GENERAL] Advice Wanted on Selecting Multi-row Data Requests in 10-Row Blocks

2008-06-27 Thread Bill Thoen
What I want to do is present the results of a query in a web page, but only 10 rows at a time. My PostgreSQL table has millions of records and if I don't add a LIMIT 10 to the SQL selection, the request can take too long. The worst case scenario is when the user requests all records without add

Re: [GENERAL] Nice to have: reverse() function in the core

2008-06-27 Thread Pavel Stehule
2008/6/27 wstrzalka <[EMAIL PROTECTED]>: > Is there any possibility to have reverse() function in the PG core in > the future? > this function is in orafce package. http://www.pgsql.cz/index.php/Oracle_functionality_%28en%29 Regards Pavel Stehule > There are some implementation already like ie.

Re: [GENERAL] Problem with FOUND

2008-06-27 Thread Pavel Stehule
2008/6/27 A B <[EMAIL PROTECTED]>: > Thanks for the suggestion on GET DIAGNOSTICS. > > But concerning EXECUTE, if I do > > BEGIN > EXECUTE QueryA > EXCEPTION WHEN OTHERS THEN > QueryB > END; > > > will it execute QueryB if QueryA fails? yes, but it's not preferable way. It creates subtran

Re: [GENERAL] IF ROW( NEW ) <> ROW( OLD )

2008-06-27 Thread Richard Broersma
On Wed, Jun 25, 2008 at 8:17 PM, Tom Lane <[EMAIL PROTECTED]> wrote: > I think IF ROW(NEW.*) <> ROW(OLD.*) will work in recent releases. > > Actually you'd better use IF ROW(NEW.*) IS DISTINCT FROM ROW(OLD.*) ... > you really don't want to rely on <> as it will not give the behavior > you want in t

Re: [GENERAL] compiling, performance of PostGreSQL 8.3 on 64-bit processors

2008-06-27 Thread Scott Marlowe
On Fri, Jun 27, 2008 at 10:21 AM, Tom Lane <[EMAIL PROTECTED]> wrote: > "Douglas McNaught" <[EMAIL PROTECTED]> writes: >> On Fri, Jun 27, 2008 at 11:52 AM, Benjamin Weaver >> <[EMAIL PROTECTED]> wrote: >>> Not knowing about such things, I was scared by the following quote. > >> Distro support for 6

[GENERAL] Nice to have: reverse() function in the core

2008-06-27 Thread wstrzalka
Is there any possibility to have reverse() function in the PG core in the future? There are some implementation already like ie. this one: http://blog.frosties.org/post/2007/08/28/Fonction-reverse-C-avec-PostgreSQL I think author will have nothing against using his code as he published it on his

Re: [GENERAL] ERROR: could not open relation with OID 2836

2008-06-27 Thread Rodrigo Gonzalez
Tom Lane wrote: > Rodrigo Gonzalez <[EMAIL PROTECTED]> writes: >> pg_dump is working fine now, the problem appear with the pg_buffercache >> query...without it I dont notice anything wrong with DBbut of course >> there is something wrong. Can be pg_buffercache the problem? > > Oh ... looking a

Re: [GENERAL] compiling, performance of PostGreSQL 8.3 on 64-bit processors

2008-06-27 Thread Douglas McNaught
On Fri, Jun 27, 2008 at 11:52 AM, Benjamin Weaver <[EMAIL PROTECTED]> wrote: > Sorry, guys, for wasting bandwidth on this! You guys gave just the answer I > wanted to hear. Sounds like there aren't any problems. > > Not knowing about such things, I was scared by the following quote. Perhaps > bi

Re: [GENERAL] ERROR: could not open relation with OID 2836

2008-06-27 Thread Tom Lane
Rodrigo Gonzalez <[EMAIL PROTECTED]> writes: > pg_dump is working fine now, the problem appear with the pg_buffercache > query...without it I dont notice anything wrong with DBbut of course > there is something wrong. Can be pg_buffercache the problem? Oh ... looking again at your latest probl

Re: [GENERAL] compiling, performance of PostGreSQL 8.3 on 64-bit processors

2008-06-27 Thread Tom Lane
"Douglas McNaught" <[EMAIL PROTECTED]> writes: > On Fri, Jun 27, 2008 at 11:52 AM, Benjamin Weaver > <[EMAIL PROTECTED]> wrote: >> Not knowing about such things, I was scared by the following quote. > Distro support for 64-bit x86 in 2004 was light-years behind where it > is now. A lot of stuff w

Re: [GENERAL] Problem with FOUND

2008-06-27 Thread A B
Thanks for the suggestion on GET DIAGNOSTICS. But concerning EXECUTE, if I do BEGIN EXECUTE QueryA EXCEPTION WHEN OTHERS THEN QueryB END; will it execute QueryB if QueryA fails? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscripti

Re: [GENERAL] compiling, performance of PostGreSQL 8.3 on 64-bit processors

2008-06-27 Thread Benjamin Weaver
Sorry, guys, for wasting bandwidth on this! You guys gave just the answer I wanted to hear. Sounds like there aren't any problems. Not knowing about such things, I was scared by the following quote. Perhaps binaries do not need to be compiled as 64 bit binaries on a 64 bit machine? Or perhaps

Re: [GENERAL] Partial Index Too Literal?

2008-06-27 Thread Phillip Mills
That example also reports that it uses the index. Only the "is true" variation insists on seq. scan. On Thu, Jun 26, 2008 at 4:08 PM, Lennin Caro <[EMAIL PROTECTED]> wrote: > use this > > explain analyze select * from result where active = 't'; > > --- On *Thu, 6/26/08, Phillip Mills <[EMAIL PRO

Re: [GENERAL] what are rules for?

2008-06-27 Thread Michael Shulman
On Fri, Jun 27, 2008 at 3:06 AM, Dean Rasheed <[EMAIL PROTECTED]> wrote: >> Someone pointed out in an earlier thread that a >> way to fix this, for updates on a multi-table view (where most of the >> complication lies), is to write a "trigger" function that updates all >> the constituent tables exc

Re: [GENERAL] ERROR: concurrent insert in progress

2008-06-27 Thread Lennin Caro
use REINDEX REINDEX ip_dst_idx OR REINDEX table_name http://www.postgresql.org/docs/8.3/static/sql-reindex.html tell us the result thank --- On Fri, 6/27/08, Ganbold <[EMAIL PROTECTED]> wrote: From: Ganbold <[EMAIL PROTECTED]> Subject: [GENERAL] ERROR: concurrent insert in progress To:

Re: [GENERAL] ERROR: concurrent insert in progress

2008-06-27 Thread Lennin Caro
use REINDEX http://www.postgresql.org/docs/8.3/static/sql-reindex.html tell us the result thank --- On Fri, 6/27/08, Ganbold <[EMAIL PROTECTED]> wrote: From: Ganbold <[EMAIL PROTECTED]> Subject: [GENERAL] ERROR: concurrent insert in progress To: pgsql-general@postgresql.org Date: Friday, Jun

Re: [GENERAL] Windows Crash

2008-06-27 Thread Dave Page
On Fri, Jun 27, 2008 at 3:37 PM, Raymond O'Donnell <[EMAIL PROTECTED]> wrote: > On 26/06/2008 17:43, Ludwig Kniprath wrote: >> >> As far as I know pgadmin uses gtk, > > Correct me if I'm wrong, but I don't think PgAdmin uses gtk on Windows. No, it most certainly doesn't. -- Dave Page EnterpriseD

Re: [GENERAL] Windows Crash

2008-06-27 Thread Raymond O'Donnell
On 26/06/2008 17:43, Ludwig Kniprath wrote: As far as I know pgadmin uses gtk, Correct me if I'm wrong, but I don't think PgAdmin uses gtk on Windows. Ray. -- Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland [EMAIL

Re: [GENERAL] ERROR: could not open relation with OID 2836

2008-06-27 Thread Tom Lane
Rodrigo Gonzalez <[EMAIL PROTECTED]> writes: > Tom Lane wrote: >> When you say "restored from backup", are you talking about a pg_dump >> backup, or what? > yes, a pg_dump backup. There must be something mighty odd in that backup. Would you be willing to send it to me off-list, so I can try to r

Re: [GENERAL] ERROR: could not open relation with OID 2836

2008-06-27 Thread Rodrigo Gonzalez
Alban Hertroys wrote: > On Jun 26, 2008, at 5:41 AM, Rodrigo Gonzalez wrote: > >> Tom Lane wrote: >>> Rodrigo Gonzalez <[EMAIL PROTECTED]> writes: Craig Ringer wrote: > What platform are you using? >>> It's running under CentOS 4.4 using ext3, no RAID or LVM. Server is quad xeon

Re: [GENERAL] ERROR: could not open relation with OID 2836

2008-06-27 Thread Rodrigo Gonzalez
Tom Lane wrote: > Rodrigo Gonzalez <[EMAIL PROTECTED]> writes: >> Tom Lane wrote: >>> No, it's clear that things are already broken before pg_dump started. >>> You need to show us how to get to this state from a fresh database. > >> Interestinga new problem maybe, or maybe the same one >>

Re: [GENERAL] Unreferenced temp tables disables vacuum to update xid

2008-06-27 Thread Csaba Nagy
Hi all, I just want to report that we had here almost exactly the same problem as reported here: http://archives.postgresql.org/pgsql-hackers/2008-01/msg00134.php The whole scenario repeated the same: production DB refused to work, restarted in single user mode, run vacuum (few hours), postgres

[GENERAL] freebsd + postgresql 8.3.3 = 100% of cpu usage on stats collector?

2008-06-27 Thread hubert depesz lubaczewski
hi first of all - i know next to nothing about bsd. friend asked me to setup replication on their machines, and i noticed that one of cpus (2 quad xeons) is used to 100%: pgsql 58241 99.0 0.2 22456 7432 ?? Rs Thu10AM 1530:35.93 postgres: stats collector process(postgres) what might be

Re: [GENERAL] Problem with FOUND

2008-06-27 Thread Pavel Stehule
2008/6/27 A B <[EMAIL PROTECTED]>: >> I think you'd be well advised to rethink your table layout so you don't >> need so much dynamic SQL. The above is going to suck on both >> performance and readability grounds, and it doesn't look like it's >> accomplishing anything you couldn't do by combining

Re: [GENERAL] Problem with FOUND

2008-06-27 Thread A B
> I think you'd be well advised to rethink your table layout so you don't > need so much dynamic SQL. The above is going to suck on both > performance and readability grounds, and it doesn't look like it's > accomplishing anything you couldn't do by combining all the Rating > tables into one table

Re: [GENERAL] what are rules for?

2008-06-27 Thread Dean Rasheed
> Date: Thu, 26 Jun 2008 12:47:04 -0500 > From: [EMAIL PROTECTED] > To: [EMAIL PROTECTED] > Subject: Re: what are rules for? > CC: pgsql-general@postgresql.org; [EMAIL PROTECTED]; [EMAIL PROTECTED]; > [EMAIL PROTECTED] > > On Thu, Jun 26, 2008 at 12:11 P