Re: [GENERAL] Query

2009-05-25 Thread Abel Camarillo
On Mon, May 25, 2009 at 02:56:10AM +, marco santillan wrote: Hola a todos: Tengo la siguiente inquietud. En una consulta com la siguiente: select campo1, campo2, campo1 - campo2 as campo_virtual, campo3, case when campo_virtual = 1 then 5 else 0 end as segundo_campo_virtual from

[GENERAL] using explain to get query expected time

2009-05-25 Thread Scara Maccai
Hi, is there any chance to get the Planner Cost Constants right enough to get a good estimate in seconds of how long a query is supposed to run? The rowcount estimates are always good (there is no skew data at all in the db, values are pretty much plain distributed) -- Sent via

Re: [GENERAL] INTERVAL data type and libpq - what format?

2009-05-25 Thread Sebastien FLAESCH
Tom Lane wrote: Ron Mayer rm...@cheapcomplexdevices.com writes: Sam Mason wrote: You get an error because 123 11 isn't a valid literal of an (undecorated) INTERVAL type. Hmm. should it be? Well, we do allow it if it's *explicitly* stated to be a day to hour interval: regression=#

[GENERAL] very large tables

2009-05-25 Thread Ramiro Diaz Trepat
Hello list,I will try to make this as brief as possible. I have a brother who is a scientist studding atmospheric problems. He was trying to handle all of his data with flat files and MatLab, when I stepped in and said, wait, you need a RDBMS to handle all this data. So, he basically has 2 very

Re: [GENERAL] very large tables

2009-05-25 Thread Otandeka Simon Peter
Try partitioning. It should sort you out. -Peter- On 5/25/09, Ramiro Diaz Trepat ram...@diaztrepat.name wrote: Hello list,I will try to make this as brief as possible. I have a brother who is a scientist studding atmospheric problems. He was trying to handle all of his data with flat files

Re: [GENERAL] very large tables

2009-05-25 Thread Matthew Brand
You might want to try CREATE CLUSTER. I had a 40M row table that was taking ages to access, I tried partitioning it into 12000 sub-tables, and obtained a modest speed up. Using CREATE CLUSTER on an un-partitioned table resulted in an enormous speed up though. You will need to choose the axis you

Re: [GENERAL] very large tables

2009-05-25 Thread Laurent Wandrebeck
Hello, I'd try to use postgis ( http://postgis.refractions.net ), that allows you to geolocalize your data. We use such an extention here for the same kind of data you use. It will lighten up table size, and queries. Otherwise, partitioning and cluster are good things to do. I would increase

Re: [GENERAL] Query

2009-05-25 Thread Alban Hertroys
On May 25, 2009, at 4:56 AM, marco santillan wrote: Hola a todos: Tengo la siguiente inquietud. En una consulta com la siguiente: select campo1, campo2, campo1 - campo2 as campo_virtual, campo3, case when campo_virtual = 1 then 5 else 0 end as segundo_campo_virtual from tabla; Esto lo puedo

Re: [GENERAL] very large tables

2009-05-25 Thread Alban Hertroys
On May 25, 2009, at 10:58 AM, Ramiro Diaz Trepat wrote: The table with the atmosphere pixels, currently has about 140MM records, and the one the values about 1000MM records. They should both grow to about twice this size. Did you tune postgres to use the available resources? By default

Re: [GENERAL] Query

2009-05-25 Thread raul . giucich
O podrías escribir, select campo1, campo2, campo1 - campo2 as campo_virtual, campo3, case when campo1 - campo2 = 1 then 5 else 0 end as segundo_campo_virtual from tabla; Saludos. R. On May 25, 2009 6:18am, Alban Hertroys dal...@solfertje.student.utwente.nl wrote: On May 25, 2009, at 4:56

[GENERAL] Java Gui for Postgress

2009-05-25 Thread queries
Hi Everyone, I need to build a simple gui front end with jdbc access to my Postgres database. I have the front end ready and I have some code which retrieves records from my database, but for some reason I keep on getting errors (lately just freezes without errors) when I apply that same code to

Re: [GENERAL] Question on Foreign Key Structure/Design

2009-05-25 Thread Johan Nel
APseudoUtopia wrote: 2. I do not want to get rid of any comments, even if the user is deleted (on the application level, I'd display something like UnknownUser or UnknownUser#1234). Right now, I just have it ON DELETE RESTRICT, but that obviously prevents any users who have commented from being

Re: [GENERAL] do postgresql this job for me ? (firebird user)

2009-05-25 Thread Tom Lane
Craig Ringer cr...@postnewspapers.com.au writes: The locking docs: http://www.postgresql.org/docs/8.3/static/explicit-locking.html don't say anything about which lock DROP INDEX takes on a relation. A quick test shows it takes an AccessExclusiveLock on the affected index, and appears to take

Re: [GENERAL] Daylight saving time question

2009-05-25 Thread Bayless Kirtley
- Original Message - From: Lew no...@lwsc.ehost-services.com To: pgsql-general@postgresql.org Sent: Saturday, May 23, 2009 2:18 PM Subject: Re: [GENERAL] Daylight saving time question Bayless Kirtley wrote: Thanks Tom and Scott. You got me looking in the right direction. In this

[GENERAL] Assistance in importing a csv file into Postgresql

2009-05-25 Thread Intengu Technologies
Dear List I have a csv file that I would like to import into Postgresql, the structure of the csv file is in this format: field1,field2,field3,field4 1,2,RD,1 2,2,RD,1 4,2,RD,1 4,2,RD,1 5,2,RD,1 5,2,RD,1 5,2,RD,1 6,2,RD,1 1,3,RD,3 2,3,RD,3 3,3,RD,3

Re: [GENERAL] Assistance in importing a csv file into Postgresql

2009-05-25 Thread Grzegorz Jaśkiewicz
what's the postgrtesql version there ? (just do select version();, or psql --version); -- 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] Assistance in importing a csv file into Postgresql

2009-05-25 Thread Stephen Frost
Greetings, * Intengu Technologies (sindile.bi...@gmail.com) wrote: What I would like to do is If field1=1 make table1 and insert the rest of field1=1 into this table If field1=2 make table2 and insert the rest of field1=2 into this table Hence in this example one will have table1, table2,

Re: [GENERAL] Assistance in importing a csv file into Postgresql

2009-05-25 Thread Grzegorz Jaśkiewicz
On Mon, May 25, 2009 at 4:12 PM, Stephen Frost sfr...@snowman.net wrote: This currently can't be done with the COPY command directly.  There are I would put it in postgresql as is, and than do CREATE TABLE foo AS SELECT CASE ... END ; -- GJ -- Sent via pgsql-general mailing list

Re: [GENERAL] using explain to get query expected time

2009-05-25 Thread Joshua Tolley
On Mon, May 25, 2009 at 12:10:21AM -0700, Scara Maccai wrote: is there any chance to get the Planner Cost Constants right enough to get a good estimate in seconds of how long a query is supposed to run? The rowcount estimates are always good (there is no skew data at all in the db, values

Re: [GENERAL] Assistance in importing a csv file into Postgresql

2009-05-25 Thread Stephen Frost
* Grzegorz Jaśkiewicz (gryz...@gmail.com) wrote: On Mon, May 25, 2009 at 4:12 PM, Stephen Frost sfr...@snowman.net wrote: This currently can't be done with the COPY command directly.  There are I would put it in postgresql as is, and than do CREATE TABLE foo AS SELECT CASE ... END ;

Re: [GENERAL] Assistance in importing a csv file into Postgresql

2009-05-25 Thread Grzegorz Jaśkiewicz
2009/5/25 Stephen Frost sfr...@snowman.net: Right, that would be option #3 from my list. :) Aye, The reason I am asking about version, is because 8.1 can't import CSV using COPY. -- GJ -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your

[GENERAL] composite type and domain

2009-05-25 Thread Grzegorz Jaśkiewicz
Why is it not possible to create domain on composite type ? Consider the example, I got (a bytea, b timestamp, c timestamp). Where b c always, and both b and c have some default value, a can stay null. Now, I don't want to go berserk, and create aditional table for that, because type is shared

Re: [GENERAL] getting a list of users

2009-05-25 Thread Eric Smith
OK, So I gave up on the universal binary, and just built a PPC version of postgres. If I execute the command: SELECT usename FROM pg_catalog.pg_user; from within psql, I get: usename - esmith radiovision (2 rows) Seems to work just fine. If, on the other hand, I issue

Re: [GENERAL] getting a list of users

2009-05-25 Thread Tom Lane
Eric Smith eric_h_sm...@mac.com writes: Seems to work just fine. If, on the other hand, I issue the same command from within the C API: NSString* query = [NSString stringWithFormat:@SELECT usename FROM pg_catalog.pg_user]; postgresResult = PQexec(myConnection, [query UTF8String]);

Re: [GENERAL] getting a list of users

2009-05-25 Thread Eric Smith
Alrighty so, how do I turn on log_statement? Thanks, Eric On May 25, 2009, at 5:31 PM, Tom Lane wrote: Eric Smith eric_h_sm...@mac.com writes: Seems to work just fine. If, on the other hand, I issue the same command from within the C API: NSString* query = [NSString

Re: [GENERAL] getting a list of users

2009-05-25 Thread Eric Smith
Very interesting. when I set log_statement='all', I see entries for various queries, but I see nothing for the query I list below. If I just use printf() to print out the c-string, it looks just like all the other queries. Eric On May 25, 2009, at 5:31 PM, Tom Lane wrote: Eric Smith

Re: [GENERAL] getting a list of users

2009-05-25 Thread Eric Smith
OK... never mind, everyone. The problem was elsewhere in the code. Regards, Eric On May 25, 2009, at 5:31 PM, Tom Lane wrote: Eric Smith eric_h_sm...@mac.com writes: Seems to work just fine. If, on the other hand, I issue the same command from within the C API: NSString* query =

Re: [GENERAL] do postgresql this job for me ? (firebird user)

2009-05-25 Thread Craig Ringer
Tom Lane wrote: Craig Ringer cr...@postnewspapers.com.au writes: Not sure how you tested that, but index_drop() clearly takes AccessExclusiveLock on the table too. (I'm not sure it really needs to --- the comment therein defending the reasoning seems out of date --- but it definitely does.)

Re: [GENERAL] Java Gui for Postgress

2009-05-25 Thread Craig Ringer
queries wrote: Hi Everyone, I need to build a simple gui front end with jdbc access to my Postgres database. I have the front end ready and I have some code which retrieves records from my database, but for some reason I keep on getting errors (lately just freezes without errors) when I

Re: [GENERAL] PGS Tuning Wizard destroys my login

2009-05-25 Thread iSTRONG
I had the same problem as OP. With Windows 7 x64 postgresql Version 8.3.7-1 It seems like running tuning wizard changes the permissions of the postgres.conf file so that the .postgres account is not able to read it. Similar to OP's situation, postgres was working fine until ran the tuning

[GENERAL] how to delete many rows from a huge table?

2009-05-25 Thread mARK bLOORE
I have a table of about 1 G rows, and I want to delete about 5 M rows, listed in another table. The big table is Table public.backlinks Column | Type | Modifiers | Description -+---+---+- key | bytea | not null |

Re: [GENERAL] Assistance in importing a csv file into Postgresql

2009-05-25 Thread Intengu Technologies
Version 8.3.7 On 25/05/2009, Grzegorz Jaśkiewicz gryz...@gmail.com wrote: what's the postgrtesql version there ? (just do select version();, or psql --version); -- Sindile Bidla -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription:

Re: [GENERAL] Assistance in importing a csv file into Postgresql

2009-05-25 Thread Intengu Technologies
Thanks for the pointers will try them. On 25/05/2009, Stephen Frost sfr...@snowman.net wrote: Greetings, * Intengu Technologies (sindile.bi...@gmail.com) wrote: What I would like to do is If field1=1 make table1 and insert the rest of field1=1 into this table If field1=2 make table2 and

Re: [GENERAL] how to delete many rows from a huge table?

2009-05-25 Thread Scott Marlowe
On Mon, May 25, 2009 at 1:29 PM, mARK bLOORE mblo...@gmail.com wrote: The table listing what I want to delete has just the key values. If I just do DELETE FROM backlinks b USING bad_links bl WHERE b.key = bl.key; then it grinds for an hour or so and runs out of memory. If I do DELETE

Re: [GENERAL] Java Gui for Postgress

2009-05-25 Thread queries
Hi Craig, Thank you for your reply and for all of the pointers. I didn't include the Gui code (It would have taken too much space), just the simple query code that already works in printing out the results I wanted. Basically I just wanted to find out how to use this code which works, inside of