Re: [GENERAL] eliminating records not in (select id ... so SLOW?

2008-08-01 Thread Ivan Sergio Borgonovo
On Thu, 31 Jul 2008 21:37:39 -0400 Tom Lane <[EMAIL PROTECTED]> wrote: > Ivan Sergio Borgonovo <[EMAIL PROTECTED]> writes: > > I'm doing something like: > > delete from table1 where id not in (select id from table2). > > table1 contains ~1M record table2 contains ~ 600K record and id > > is unique

Re: [GENERAL] Copy fails

2008-08-01 Thread Craig Ringer
Abraham, Danny wrote: > I am loading a huge file using C, STDIN Using C? Have you written a C program using libpq to load some data, which it reads from its stdin? Or do you mean COPY FROM STDIN ? Something else? Perhaps if you provided a clearer and more complete explanation of your problem y

Re: [GENERAL] Cursor Error

2008-08-01 Thread Craig Ringer
Bob Pawley wrote: > Is it allowed to declare a cursor in this manner?? > > Declare > procgraphic cursor for select p_id.p_id.process_id > from p_id.p_id, processes_count > where p_id.p_id.p_id_id = processes_count.p_id_id; Using DECLARE instead of OPEN? Yes, but that won't somehow make a cursor i

[GENERAL] Postgresql not using an index

2008-08-01 Thread Marc Cuypers
Hi, I'm using postgres 7.4 and bacula 1.38 on debian. In the bacula database there is a table named 'file' which has about 2.5 million rows. In this table there is a field 'jobid' which is indexed. The index is created with the following command: CREATE INDEX file_jobid_idx ON file U

Re: [GENERAL] Postgresql not using an index

2008-08-01 Thread Pavel Stehule
Hello please, send EXPLAIN ANALYZE output. regards Pavel Stehule 2008/8/1 Marc Cuypers <[EMAIL PROTECTED]>: > Hi, > > I'm using postgres 7.4 and bacula 1.38 on debian. > > In the bacula database there is a table named 'file' which has about 2.5 > million rows. > In this table there is a field 'j

Re: [GENERAL] Postgresql not using an index

2008-08-01 Thread Gregory Williamson
Marc -- > Hi, > > I'm using postgres 7.4 and bacula 1.38 on debian. > > In the bacula database there is a table named 'file' which has about 2.5 > million rows. > In this table there is a field 'jobid' which is indexed. > The index is created with the following command: > CREATE INDEX fil

Re: [GENERAL] Postgresql not using an index

2008-08-01 Thread Marc Cuypers
Hi Pavel, Isn't the text for the Verbose Explain analyze not enough? Is not, how can i generate it? -- Best regards, Marc Pavel Stehule schreef: Hello please, send EXPLAIN ANALYZE output. regards Pavel Stehule 2008/8/1 Marc Cuypers <[EMAIL PROTECTED]>: Hi, I'm using postgres 7.4 and bacu

Re: [GENERAL] Postgresql not using an index

2008-08-01 Thread Pavel Stehule
2008/8/1 Marc Cuypers <[EMAIL PROTECTED]>: > Hi Pavel, > > Isn't the text for the Verbose Explain analyze not enough? > Is not, how can i generate it? > > -- no, I am missing statistics info try EXPLAIN ANALYZE SELECT . regards Pavel Stehule > Best regards, > > Marc > > Pavel Stehule schree

[GENERAL] function definition and "entity"

2008-08-01 Thread Ivan Sergio Borgonovo
I've to refactor a bunch of functions. Some of them are called inside other functions. Most of them could be changed through create or replace so... calling function should still refer to the right newer function. But some had to be dropped because the change was in output param. Is there a way t

Re: [GENERAL] eliminating records not in (select id ... so SLOW?

2008-08-01 Thread Daniel Verite
Ivan Sergio Borgonovo wrote: But what if I *really* had to execute that query? Any other magic I could play to speed it up? A trick that is sometimes spectacularly efficient is to rewrite the query to use an outer join instead of NOT IN. Try: DELETE FROM table1 WHERE id IN (SELECT

Re: [GENERAL] Postgresql not using an index

2008-08-01 Thread Marc Cuypers
Hi Pavel, Pavel Stehule schreef: 2008/8/1 Marc Cuypers <[EMAIL PROTECTED]>: Hi Pavel, Isn't the text for the Verbose Explain analyze not enough? Is not, how can i generate it? -- no, I am missing statistics info try EXPLAIN ANALYZE SELECT . regards I entered the command in pgsql an

Re: [GENERAL] Postgresql not using an index

2008-08-01 Thread Pavel Stehule
2008/8/1 Marc Cuypers <[EMAIL PROTECTED]>: > Hi Pavel, > > Pavel Stehule schreef: >> >> 2008/8/1 Marc Cuypers <[EMAIL PROTECTED]>: >>> >>> Hi Pavel, >>> >>> Isn't the text for the Verbose Explain analyze not enough? >>> Is not, how can i generate it? >>> >>> -- >> >> >> no, I am missing statistics

Re: [GENERAL] pg crashing

2008-08-01 Thread Magnus Hagander
Roberts, Jon wrote: >> Roberts, Jon wrote: Not having looked at the internals of db_link, I'd say it's > certainly possible that this is the reason for the failed restart. If db_link > is blocking something, the postmaster can't kill it off, and it'll > still >>> be sitting ther

Re: [GENERAL] Clone a database to other machine

2008-08-01 Thread Henry - Zen Search SA
On Thu, July 31, 2008 10:07 am, Chris wrote: > Garg, Manjit wrote: > Check out slony (http://slony.info/) - it's a master->multiple slave > replication system and seems to work pretty well. You can also try SkyTools (http://pgfoundry.org/projects/skytools/) - it's far simpler to use and to manage

Re: [GENERAL] eliminating records not in (select id ... so SLOW?

2008-08-01 Thread Lennin Caro
ok try this delete from catalog_categoryitem where not exists (select id from catalog_items where catalog_items.ItemID = catalog_categoryitem.ItemID); --- On Thu, 7/31/08, Ivan Sergio Borgonovo <[EMAIL PROTECTED]> wrote: > From: Ivan Sergio Borgonovo <[EMAIL PROTECTED]> > Subject: Re: [GENERA

[GENERAL] use of column in COPY

2008-08-01 Thread Ivan Sergio Borgonovo
what's the use of column in the COPY FROM syntax if I get: ERROR: extra data after last expected column I've read: http://bytes.com/forum/thread424089.html but then... is there any actual use? -- Ivan Sergio Borgonovo http://www.webthatworks.it -- Sent via pgsql-general mailing list (pgsql

Re: [GENERAL] eliminating records not in (select id ... so SLOW?

2008-08-01 Thread Tom Lane
Ivan Sergio Borgonovo <[EMAIL PROTECTED]> writes: > Well I reached 3Gb of work_mem and still I got: > "Seq Scan on catalog_categoryitem (cost=31747.84..4019284477.13 > rows=475532 width=6)" > " Filter: (NOT (subplan))" > " SubPlan" > "-> Materialize (cost=31747.84..38509.51 rows=676167 wi

Re: [GENERAL] eliminating records not in (select id ... so SLOW?

2008-08-01 Thread Ivan Sergio Borgonovo
On Fri, 01 Aug 2008 10:33:59 -0400 Tom Lane <[EMAIL PROTECTED]> wrote: > Ivan Sergio Borgonovo <[EMAIL PROTECTED]> writes: > > Well I reached 3Gb of work_mem and still I got: > > > "Seq Scan on catalog_categoryitem (cost=31747.84..4019284477.13 > > rows=475532 width=6)" > > " Filter: (NOT (subp

Re: [GENERAL] eliminating records not in (select id ... so SLOW?

2008-08-01 Thread Tom Lane
Ivan Sergio Borgonovo <[EMAIL PROTECTED]> writes: > Tom Lane <[EMAIL PROTECTED]> wrote: >> Huh. The only way I can see for that to happen is if the datatypes >> involved aren't hashable. What's the datatypes of the two columns >> being compared, anyway? > thanks to svn I'd say you're right... on

Re: [GENERAL] use of column in COPY

2008-08-01 Thread David Wilson
On Fri, Aug 1, 2008 at 10:16 AM, Ivan Sergio Borgonovo <[EMAIL PROTECTED]> wrote: > what's the use of column in the COPY FROM syntax if I get: > > ERROR: extra data after last expected column > > I've read: > http://bytes.com/forum/thread424089.html > > but then... is there any actual use? > I us

[GENERAL] savepoint problems

2008-08-01 Thread Linos
Hello, i have migrated from Maxdb to Postgresql recently and i am having a speed problem in large transactions over slow links because of autorollback on error postgresql feature, i create data in any tables with triggers in other tables and i do large inserts from the data created in this

Re: [GENERAL] savepoint problems

2008-08-01 Thread Martijn van Oosterhout
On Fri, Aug 01, 2008 at 06:30:36PM +0200, Linos wrote: > Hello, > i have migrated from Maxdb to Postgresql recently and i am having a > speed problem in large transactions over slow links because of > autorollback > on error postgresql feature, i create data in any tables with triggers i

[GENERAL] Savepoints and SELECT FOR UPDATE in 8.2

2008-08-01 Thread EXT-Rothermel, Peter M
I have a client application that needs: SELECT a set of records from a table and lock them for potential updates. for each record make some updates to this record and some other records in other tables call some call a function that does some application logic that does not access the da

[GENERAL] GROUP BY hour

2008-08-01 Thread Nathan Thatcher
I have, what I imagine to be, a fairly simple question. I have a query that produces output for a line graph. Each row represents an interval on the graph. SELECT COUNT(call_id) AS value, EXTRACT(hour from start_time) AS hour FROM c_call WHERE start_time >= '2008-08-01 00:00:00' AND end_time <= '

Re: [GENERAL] GROUP BY hour

2008-08-01 Thread Steve Crawford
Nathan Thatcher wrote: I have, what I imagine to be, a fairly simple question. I have a query that produces output for a line graph. Each row represents an interval on the graph. SELECT COUNT(call_id) AS value, EXTRACT(hour from start_time) AS hour FROM c_call WHERE start_time >= '2008-08-01 00

Re: [GENERAL] GROUP BY hour

2008-08-01 Thread Osvaldo Rosario Kussama
Nathan Thatcher escreveu: I have, what I imagine to be, a fairly simple question. I have a query that produces output for a line graph. Each row represents an interval on the graph. SELECT COUNT(call_id) AS value, EXTRACT(hour from start_time) AS hour FROM c_call WHERE start_time >= '2008-08-01

Re: [GENERAL] GROUP BY hour

2008-08-01 Thread Nathan Thatcher
Brilliant! On Fri, Aug 1, 2008 at 12:18 PM, Steve Crawford <[EMAIL PROTECTED]> wrote: > Nathan Thatcher wrote: >> >> I have, what I imagine to be, a fairly simple question. I have a query >> that produces output for a line graph. Each row represents an interval >> on the graph. >> >> SELECT COUNT(

Re: [GENERAL] savepoint problems

2008-08-01 Thread Tom Lane
Martijn van Oosterhout <[EMAIL PROTECTED]> writes: > On Fri, Aug 01, 2008 at 06:30:36PM +0200, Linos wrote: >> i have migrated from Maxdb to Postgresql recently and i am having a >> speed problem in large transactions over slow links because of autorollback > If the goal is to reduce latency cos

[GENERAL] non-WAL btree?

2008-08-01 Thread Alex Vinogradovs
Guys, I was wondering if there is a btree indexing implementation that is not WAL-logged. I'm loading data in bulks, and index logging is an unnecessary overhead for me (easier to rebuild on crash). Thanks! best regards, Alex Vinogradovs -- Sent via pgsql-general mailing list (pgsql-general@po

Re: [GENERAL] non-WAL btree?

2008-08-01 Thread Joshua Drake
On Fri, 01 Aug 2008 12:41:12 -0700 Alex Vinogradovs <[EMAIL PROTECTED]> wrote: > Guys, > > I was wondering if there is a btree indexing implementation that > is not WAL-logged. I'm loading data in bulks, and index logging > is an unnecessary overhead for me (easier to rebuild on crash). Drop the

Re: [GENERAL] non-WAL btree?

2008-08-01 Thread Alex Vinogradovs
By loading in bulks, I mean I load some 40-50 thousand rows at once into a table that already has some millions. Index rebuild on that table after each 50k inserts will be even less efficient ;) Alex. On Fri, 2008-08-01 at 12:57 -0700, Joshua Drake wrote: > On Fri, 01 Aug 2008 12:41:12 -0700 > Al

Re: [GENERAL] non-WAL btree?

2008-08-01 Thread David Wilson
On Fri, Aug 1, 2008 at 4:07 PM, Alex Vinogradovs <[EMAIL PROTECTED]> wrote: > By loading in bulks, I mean I load some 40-50 thousand > rows at once into a table that already has some millions. > Index rebuild on that table after each 50k inserts will > be even less efficient ;) How many indexes do

Re: [GENERAL] non-WAL btree?

2008-08-01 Thread Joshua Drake
On Fri, 01 Aug 2008 13:07:18 -0700 Alex Vinogradovs <[EMAIL PROTECTED]> wrote: > By loading in bulks, I mean I load some 40-50 thousand > rows at once into a table that already has some millions. > Index rebuild on that table after each 50k inserts will > be even less efficient ;) Fair enough, to

Re: [GENERAL] non-WAL btree?

2008-08-01 Thread David Wilson
On Fri, Aug 1, 2008 at 4:16 PM, David Wilson <[EMAIL PROTECTED]> wrote: > On Fri, Aug 1, 2008 at 4:07 PM, Alex Vinogradovs > <[EMAIL PROTECTED]> wrote: >> By loading in bulks, I mean I load some 40-50 thousand >> rows at once into a table that already has some millions. >> Index rebuild on that tab

Re: [GENERAL] non-WAL btree?

2008-08-01 Thread Alex Vinogradovs
Isn't hash indexing implementation non-WAL ? Alex. On Fri, 2008-08-01 at 13:16 -0700, Joshua Drake wrote: > On Fri, 01 Aug 2008 13:07:18 -0700 > Alex Vinogradovs <[EMAIL PROTECTED]> wrote: > > > By loading in bulks, I mean I load some 40-50 thousand > > rows at once into a table that already has

Re: [GENERAL] non-WAL btree?

2008-08-01 Thread Alex Vinogradovs
It's not that I expect a lot of improvement by having non-WAL indexing, it just sounds logical to me to have that, since index can be re-created fast enough during recovery, and it would reduce my IO to some extent. Alex. > Sorry, as I hit send, I realized I should clarify this: I do my bulk > lo

Re: [GENERAL] non-WAL btree?

2008-08-01 Thread Francisco Reyes
On 4:36 pm 08/01/08 Alex Vinogradovs <[EMAIL PROTECTED]> wrote: > It's not that I expect a lot of improvement by having non-WAL > indexing Have you tried using a fill factor less than 90%? That is on my list of things to test, but have not done yet.. In particular you need to find a balance where

Re: [GENERAL] non-WAL btree?

2008-08-01 Thread Jaime Casanova
On Fri, Aug 1, 2008 at 3:32 PM, Alex Vinogradovs <[EMAIL PROTECTED]> wrote: > Isn't hash indexing implementation non-WAL ? > yes, but that's because no one thinks is worth the effort of making them WAL logged while they keep slower than btree... -- regards, Jaime Casanova Soporte y capacitación

Re: [GENERAL] non-WAL btree?

2008-08-01 Thread Jaime Casanova
On Fri, Aug 1, 2008 at 3:36 PM, Alex Vinogradovs <[EMAIL PROTECTED]> wrote: > It's not that I expect a lot of improvement by having non-WAL > indexing, it just sounds logical to me to have that, since > index can be re-created fast enough during recovery, and why you think that? if they are non WA

Re: [GENERAL] non-WAL btree?

2008-08-01 Thread Alex Vinogradovs
It's all about number of repetions. If say I load my table with 50k every minute, and run reindex every minute, how long do you think it would take by end of the day, when my table (it's daily partition actually) is at maximum capacity ? And database may actually never crash, and I won't have to ru

[GENERAL] Is there any reason why "edit PostgreSQL.conf should be on my menu"

2008-08-01 Thread John Meyer
Especially when I haven't edited anything yet? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] savepoint problems

2008-08-01 Thread Linos
David Wilson escribió: On Fri, Aug 1, 2008 at 12:30 PM, Linos <[EMAIL PROTECTED]> wrote: Well i would like to know if every can help with any other idea or any notes on this problem? Other question i have it is how i could create a function without be sure the number of columns to insert/update

Re: [GENERAL] savepoint problems

2008-08-01 Thread Linos
Tom Lane escribió: Martijn van Oosterhout <[EMAIL PROTECTED]> writes: On Fri, Aug 01, 2008 at 06:30:36PM +0200, Linos wrote: i have migrated from Maxdb to Postgresql recently and i am having a speed problem in large transactions over slow links because of autorollback If the goal is to redu

Re: [GENERAL] non-WAL btree?

2008-08-01 Thread Glen Parker
Jaime Casanova wrote: > On Fri, Aug 1, 2008 at 3:36 PM, Alex Vinogradovs > <[EMAIL PROTECTED]> wrote: >> It's not that I expect a lot of improvement by having non-WAL >> indexing, it just sounds logical to me to have that, since >> index can be re-created fast enough during recovery, > > and why y

Re: [GENERAL] [SQL] Savepoints and SELECT FOR UPDATE in 8.2

2008-08-01 Thread Scott Marlowe
On Fri, Aug 1, 2008 at 11:02 AM, EXT-Rothermel, Peter M <[EMAIL PROTECTED]> wrote: > > I was thinking of something like this: > > connect to DB > > BEGIN > > SELECT * FROM table_foo where foo_state = 'queued' FOR UPDATE; > for each row > do [ > >SAVEPOINT s; >UPDATE foo_resource SET in_use

Re: [GENERAL] hibernate nativequery and uuid

2008-08-01 Thread Andrew
oops, forgot to cc the mailing list again... Andrew wrote: I know none of this relates directly to postgresql and on reflection is probably more appropriate for the hibernate forums. So apologies for having raised the topic here. Also, thanks for the suggestions that I have received on the t

[GENERAL] why so many error when I load the data to database from a script which generated by pg_dump.

2008-08-01 Thread Yi Zhao
hi, all: I have a database to store the information about the html source of the web page. I wan't to move the data to another database, so I pg_dump the data to a file: /usr/local/pgsql/bin/pg_dump htmldb -Upostgres -p 5433 > /tmp/dump.sql now, I load the data into new database: /u

Re: [GENERAL] How to remove duplicate lines but save one of the lines?

2008-08-01 Thread Julio Cesar Sánchez González
A B wrote: I have a table with rows like this A 1 A 1 B 3 B 3 C 44 C 44 and so on. and I want it to be A 1 B 3 C 44 so how can I remove the all the duplicate lines but one? Try with: your table structure for example: create table yourtable(campo1 char, num integer); select * from yourt