Re: [GENERAL] "sniffing" postgres queries

2007-03-20 Thread Anton Melser
On 21/03/07, Tom Lane <[EMAIL PROTECTED]> wrote: "Anton Melser" <[EMAIL PROTECTED]> writes: > I am having real trouble with a project that is a little out of my > league and I just can't find out how to find which table the app is > getting its values from (it's a long story...). I know what valu

[GENERAL] Postgres Hot Standby. How or when does the recovery db move recovery.conf to recovery.done?

2007-03-20 Thread Dhaval Shah
Resending. I have a "hot" standby. Now, if the primary fails how do I tell the secondary that come out of recovery mode and move the recovery.conf to recovery.done and start the db. I mean, what error code shall I return? If I return a non-zero error code (1), I get the following result [from se

Re: [GENERAL] select progressive total

2007-03-20 Thread Merlin Moncure
On 3/21/07, brian <[EMAIL PROTECTED]> wrote: From the "I thought this would be trivially easy" dept: I have a table holding member data for an organisation CREAT table member ( id SERIAL PRIMARY KEY, applied date, ... and i'd like to plot the growth in memberships. I'd pr

Re: [GENERAL] sql indexing suggestions needed

2007-03-20 Thread Jonathan Vanasco
On Mar 20, 2007, at 3:24 PM, Ron Johnson wrote: How many *distinct* values are there in int_c? What percentage of them match "int_c <= 10"? right now there are 14, and 80% match -- but next week that number will be 20 , 60% ... and so on Same questions, but for int_h. same answer If i

Re: [GENERAL] Approximate join on timestamps

2007-03-20 Thread Klint Gore
On Tue, 20 Mar 2007 23:30:46 +, "Phil Endecott" <[EMAIL PROTECTED]> wrote: > I have two tables containing chronological data, and I want to join > them using the timestamps. The challenge is that the timestamps only > match approximately. > > My first attempt was something like > >t1 j

Re: [GENERAL] Approximate join on timestamps

2007-03-20 Thread Brent Wood
Phil Endecott wrote: Dear Experts, I have two tables containing chronological data, and I want to join them using the timestamps. The challenge is that the timestamps only match approximately. Hi Phil, This is how we dealt with a similar situation. It may be suitable for you We hav

Re: [GENERAL] "sniffing" postgres queries

2007-03-20 Thread Tom Lane
"Anton Melser" <[EMAIL PROTECTED]> writes: > I am having real trouble with a project that is a little out of my > league and I just can't find out how to find which table the app is > getting its values from (it's a long story...). I know what values I > am looking for, and would like to log everyt

Re: Fwd: [GENERAL] Approximate join on timestamps

2007-03-20 Thread Jorge Godoy
"Rhys Stewart" <[EMAIL PROTECTED]> writes: > had a similar problem a while back. so i made and abs_time function: > > CREATE OR REPLACE FUNCTION abs_time(interval) > RETURNS interval AS > $BODY$ > BEGIN > if >$1 < '00:00:00'::interval > then >return ($1 * -1)::interval; > else >

Re: [GENERAL] Approximate join on timestamps

2007-03-20 Thread Jorge Godoy
"Phil Endecott" <[EMAIL PROTECTED]> writes: > I have two tables containing chronological data, and I want to join them using > the timestamps. The challenge is that the timestamps only match > approximately. > > My first attempt was something like > > t1 join t2 on (abs(t1.t-t2.t)<'1 min'::int

Fwd: [GENERAL] Approximate join on timestamps

2007-03-20 Thread Rhys Stewart
-- Forwarded message -- From: Rhys Stewart <[EMAIL PROTECTED]> Date: Mar 20, 2007 6:50 PM Subject: Re: [GENERAL] Approximate join on timestamps To: Phil Endecott <[EMAIL PROTECTED]> had a similar problem a while back. so i made and abs_time function: CREATE OR REPLACE FUNCTION a

Re: [GENERAL] "sniffing" postgres queries

2007-03-20 Thread John DeSoi
You might be able to get enough information looking at the raw frontend/backend protocol exchange (http://www.postgresql.org/docs/ 8.2/static/protocol.html) using something like tcpflow or Ethereal. On Mar 20, 2007, at 5:45 PM, Anton Melser wrote: I am having real trouble with a project th

[GENERAL] Approximate join on timestamps

2007-03-20 Thread Phil Endecott
Dear Experts, I have two tables containing chronological data, and I want to join them using the timestamps. The challenge is that the timestamps only match approximately. My first attempt was something like t1 join t2 on (abs(t1.t-t2.t)<'1 min'::interval) Of course there is no "abs" for

Re: [GENERAL] Unable to start postgres in recovery mode.

2007-03-20 Thread Dhaval Shah
Thanks for the email. It helped and after going through the email and the doc, I realized that the "backup" file had the wrong information, or rather I had the wrong backup files. That will do the kind of errors I have seen. However, I do have one question, I am setting this up as part of the HA

Re: [GENERAL] Bug in CREATE/DROP TABLESPACE command

2007-03-20 Thread Bruce Momjian
What version of PostgreSQL is this? Please provide the SQL commands that cause this problem, with error output. --- William Garrison wrote: > On Windows Server 2003, if you create a tablespace to a location that > doesn't

Re: [GENERAL] Postgresql to Delphi

2007-03-20 Thread Arthur Hoogervorst
Hi: There are a couple of solutions to solve this problem and some of them will depend on how frequent you expect these changes to happen. I generally stay clear from server-specific notifications: In the larger projects I have seen and maintained, we used background processes to do this kind of

Re: [GENERAL] Lifecycle of PostgreSQL releases

2007-03-20 Thread Joshua D. Drake
Bruce Momjian wrote: > As the owner of a 1986 Toyota Celica, I can accept the argument that a > newer car with slightly brighter paint might not be worth the switch. > > However, considering the number of features proposed for 8.3, we might > not have 8.3 final until September/October. That may c

Re: [GENERAL] Postgresql to Delphi

2007-03-20 Thread Bob Pawley
I think that may be what I have been trying to do. Can you point me to some literature on how to do that? I'm just learning the basics of Delphi and the documenation I've seen so far hasn't been very specific. Bob - Original Message - From: "Tony Caduto" <[EMAIL PROTECTED]> To: "B

Re: [GENERAL] Lifecycle of PostgreSQL releases

2007-03-20 Thread Bruce Momjian
As the owner of a 1986 Toyota Celica, I can accept the argument that a newer car with slightly brighter paint might not be worth the switch. However, considering the number of features proposed for 8.3, we might not have 8.3 final until September/October. I am not saying that will happen, but it

Re: [GENERAL] Postgresql to Delphi

2007-03-20 Thread Tony Caduto
Bob Pawley wrote: Listen/notify implies a dynamic table that is constantly on the change. Am I correct? The table I am talking about is completed through one interface then imported as a relatively static information base for the application in which I am seeking help. Yes, you would have

Re: [GENERAL] Postgresql to Delphi

2007-03-20 Thread Bob Pawley
The user clicks on a button. A Query component, connected to the button, and the structure of the database determines how many of the devices will be triggered in the application. I envision triggering a "loop" which is from one to seven devices with one button or a specific series of loops wi

Re: [GENERAL] Postgresql to Delphi

2007-03-20 Thread Bob Pawley
Listen/notify implies a dynamic table that is constantly on the change. Am I correct? The table I am talking about is completed through one interface then imported as a relatively static information base for the application in which I am seeking help. Bob - Original Message - From

[GENERAL] "sniffing" postgres queries

2007-03-20 Thread Anton Melser
Hi, I am having real trouble with a project that is a little out of my league and I just can't find out how to find which table the app is getting its values from (it's a long story...). I know what values I am looking for, and would like to log everything (even if only for one call of a web page.

Re: [GENERAL] Postgresql to Delphi

2007-03-20 Thread Geoffrey
Andrej Ricnik-Bay wrote: On 3/21/07, Bob Pawley <[EMAIL PROTECTED]> wrote: Each time the user wants a new device displayed he needs to click on the TImage. This is time consuming and prone to error. I guess I must be too obtuse to follow; how will the database know when the user wants to see a

Re: [GENERAL] quoted identifier behaviour

2007-03-20 Thread Bruce Momjian
Randall Smith wrote: > Thanks Tom. I understand your points and I gather that the cost of > making the change (even as an option) outweighs the benefits of SQL > conformance for the developers. Though I'm still of the same opinion. > > I'll give the pghackers forum a visit and since I'm alread

Re: [GENERAL] Postgresql to Delphi

2007-03-20 Thread Andrej Ricnik-Bay
On 3/21/07, Bob Pawley <[EMAIL PROTECTED]> wrote: Each time the user wants a new device displayed he needs to click on the TImage. This is time consuming and prone to error. I guess I must be too obtuse to follow; how will the database know when the user wants to see a new device if not by way

Re: [GENERAL] Possible planner bug?

2007-03-20 Thread Jeff Davis
On Mon, 2007-03-19 at 14:31 -0400, Tom Lane wrote: > Jeff Davis <[EMAIL PROTECTED]> writes: > > I have two indexes defined on "syslog_p": > > > "syslog_p_severity_ts_idx" btree (severity, ts) > > "syslog_p_ts_where_severity_1_idx" btree (ts) WHERE severity = 1 > > > The planner chooses what looks

Re: [GENERAL] Postgresql to Delphi

2007-03-20 Thread Bob Pawley
Each time the user wants a new device displayed he needs to click on the TImage. This is time consuming and prone to error. I have a list of devices in a PostgreSQL table. I want that table list to trigger the Delphi app instead of the user. I'm just learning Delphi. It seems that the error i

Re: [GENERAL] Postgresql to Delphi

2007-03-20 Thread Tony Caduto
Bob Pawley wrote: Hi I have posed this question to the Delphi list but they don't appear to be able to help. I am attempting to have the information in a PostgreSQL database table trigger a function in Delphi. At present the delphi application is triggered by a mouseup on a TImage file,

Re: [GENERAL] Postgresql to Delphi

2007-03-20 Thread Richard Huxton
Bob Pawley wrote: Hi I have posed this question to the Delphi list but they don't appear to be able to help. I am attempting to have the information in a PostgreSQL database table trigger a function in Delphi. Not sure what the Delphi stuff was on about - not my field. You've basically got t

[GENERAL] select progressive total

2007-03-20 Thread brian
From the "I thought this would be trivially easy" dept: I have a table holding member data for an organisation CREAT table member ( id SERIAL PRIMARY KEY, applied date, ... and i'd like to plot the growth in memberships. I'd prefer to hand off the data already totaled, if

Re: [GENERAL] Postgresql to Delphi

2007-03-20 Thread Andrej Ricnik-Bay
On 3/21/07, Bob Pawley <[EMAIL PROTECTED]> wrote: Hi I have posed this question to the Delphi list but they don't appear to be able to help. I am attempting to have the information in a PostgreSQL database table trigger a function in Delphi. I believe that you'd need to have an untrusted langu

Re: [GENERAL] LISTEN/NOTIFY and python

2007-03-20 Thread Tino Wildenhain
John D. Burger schrieb: Tom Lane wrote: The standard approach when using libpq directly is to get the file descriptor number of the backend connection with PQsocket(), then include that in the set of FDs that the client app's idle loop select()s or poll()s on. And Tino Wildenhain, in off-list

Re: [GENERAL] sql indexing suggestions needed

2007-03-20 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 03/20/07 14:11, Jonathan Vanasco wrote: > > On Mar 20, 2007, at 2:54 PM, Jonathan Vanasco wrote: > >> No matter how I index + analyze this table, including making an index >> of every related column on the search, pg keeps doing a sequential >> sc

Re: [GENERAL] sql indexing suggestions needed

2007-03-20 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 03/20/07 13:54, Jonathan Vanasco wrote: > i'm going crazy trying to optimize this select. > > The table has ~25 columns, the select is based on 10. There are approx > 5 million records in the table and growing. > > No matter how I index + analyz

Re: [GENERAL] sql indexing suggestions needed

2007-03-20 Thread Jonathan Vanasco
On Mar 20, 2007, at 2:54 PM, Jonathan Vanasco wrote: No matter how I index + analyze this table, including making an index of every related column on the search, pg keeps doing a sequential scan and never includes an index -- which takes ~2minutes to do. I really need to cut this down.

Re: [GENERAL] sql indexing suggestions needed

2007-03-20 Thread Benjamin Arai
I wonder if converting all of your bools to a bit string and storing that string as a number would make things faster? Benjamin On Mar 20, 2007, at 11:54 AM, Jonathan Vanasco wrote: i'm going crazy trying to optimize this select. The table has ~25 columns, the select is based on 10. There

[GENERAL] sql indexing suggestions needed

2007-03-20 Thread Jonathan Vanasco
i'm going crazy trying to optimize this select. The table has ~25 columns, the select is based on 10. There are approx 5 million records in the table and growing. No matter how I index + analyze this table, including making an index of every related column on the search, pg keeps doing a

[GENERAL] Postgresql to Delphi

2007-03-20 Thread Bob Pawley
Hi I have posed this question to the Delphi list but they don't appear to be able to help. I am attempting to have the information in a PostgreSQL database table trigger a function in Delphi. At present the delphi application is triggered by a mouseup on a TImage file, residing in a notebook,

Re: [GENERAL] How to disable displaying of a NOTICE context?

2007-03-20 Thread Bruce Momjian
Dmitry Koterov wrote: > Thanks! > > With RAISE NOTICE "terse" mode works great, CONTEXT is not shown. > > But does "terse" also disable CONTEXT displaying on fatal errors inside a > stored function? If it does, it is not so useful as it could be, because I > don't think that fatal error context h

[GENERAL] SoC Ideas for people looking for projects

2007-03-20 Thread Benjamin Arai
Hi, If you are looking for a SoC idea, I have listed a couple below. I am not sure how good of an idea they are but I have ran into the following limitations and probably other people have as well in the past. 1. Can user based priorities be implemented as a summer project? To some ex

Re: [GENERAL] Reference Type in PostgreSQL

2007-03-20 Thread Jeff Davis
On Tue, 2007-03-20 at 10:21 -0400, Merlin Moncure wrote: > On 3/19/07, Elena <[EMAIL PROTECTED]> wrote: > > Hello all, I'm new in PostgreSQL... > > > > I would want to know like PostgreSQL manages the type reference that defines > > the standard SQL:1999. I want to define the type of attribute like

Re: [GENERAL] LISTEN/NOTIFY and python

2007-03-20 Thread John D. Burger
Tom Lane wrote: The standard approach when using libpq directly is to get the file descriptor number of the backend connection with PQsocket(), then include that in the set of FDs that the client app's idle loop select()s or poll()s on. And Tino Wildenhain, in off-list mail, described getting

Re: [GENERAL] Planner tuning

2007-03-20 Thread Alban Hertroys
Dmitry Koterov wrote: > I don't know exactly is it your case, but sometimes > > SET enable_sort = off; > > speeds up some queries by the factor of hundred. But in some cases this > command slows down operations, so I TEMPORARILY switch enable_sort on and > off for some queries. It affects the que

[GENERAL] Reminder: only 5 days left to submit SoC applications

2007-03-20 Thread Josh Berkus
Students & Professors, There are only 5 days left to submit your PostgreSQL Google Summer of Code Project: http://www.postgresql.org/developer/summerofcode.html If you aren't a student, but know a CS student interested in databases, testing, GUIs, or any other OSS coding, please point them to

Re: [GENERAL] shell script to SQL statement: `pg_dump | psql -U`

2007-03-20 Thread Richard Huxton
filippo wrote: The problem with the current implementation is that sometime pd_dump and psql ask for password but I want to create the database copy without any user typing (it is a cron script) Consider using the PGPASSWORD environment variable or .pgpass file. -- Richard Huxton Archonet

Re: [GENERAL] pg installation for dummies

2007-03-20 Thread Tom Lane
Rick Schumeyer <[EMAIL PROTECTED]> writes: > 1) People often ask about the memory settings in postgresql.conf. Aside from the ones you mentioned, checkpoint_segments is my favorite bottleneck. It doesn't matter for a read-mostly database, but under any sort of write-intensive load you really got

Re: [GENERAL] pg installation for dummies

2007-03-20 Thread Ron Johnson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 03/20/07 10:27, Rick Schumeyer wrote: > I'm writing an article based on my experience setting up a ruby-on-rails > server for a web apps class I'm teaching. My target audience is people > who have a clue, > but are not gurus at the wide collection

Re: [GENERAL] shell script to SQL statement: `pg_dump | psql -U`

2007-03-20 Thread Tom Lane
"filippo" <[EMAIL PROTECTED]> writes: > The problem with the current implementation is that sometime pd_dump > and psql ask for password but I want to create the database copy > without any user typing (it is a cron script). Create a ~/.pgpass file for the user that runs the cron job.

Re: [GENERAL] LISTEN/NOTIFY and python

2007-03-20 Thread Tom Lane
"John D. Burger" <[EMAIL PROTECTED]> writes: > Does anyone have any suggestions for how to write client python code > that uses LISTEN? The only thing I can find is the older PyGreSQL > module (import pg), which has getnotify(), but this seems to require > busy-waiting. Is there any way to

[GENERAL] pg installation for dummies

2007-03-20 Thread Rick Schumeyer
I'm writing an article based on my experience setting up a ruby-on-rails server for a web apps class I'm teaching. My target audience is people who have a clue, but are not gurus at the wide collection of software necessary to get a server running. The in-work article is at http://www.schumey

[GENERAL] shell script to SQL statement: `pg_dump | psql -U`

2007-03-20 Thread filippo
I have a perl program that I use (also) to copy a database to a perfect clone having a different name. To perform the operation I execute from perl the following shell pipe pg_dump -U postgres -h db_server database_name | psql -U postgres -h db_server database_name_backup I'd like to perform the

[GENERAL] Job Opening for PostgreSQL DBA in Pune.

2007-03-20 Thread Poornima
Hi , We have excellent and urgent job opening for PostgreSQL position with one of our esteemed client in Pune. Job Description : Skill Set : PostgreSQL Experience : 5 - 7yrs Job location: Pune Please send your updated resume along with your CTC details to [EMAIL PROTECTE

[GENERAL] LISTEN/NOTIFY and python

2007-03-20 Thread John D. Burger
Hi - Does anyone have any suggestions for how to write client python code that uses LISTEN? The only thing I can find is the older PyGreSQL module (import pg), which has getnotify(), but this seems to require busy-waiting. Is there any way to do this that will use select() or something

Re: [GENERAL] Unable to start postgres in recovery mode.

2007-03-20 Thread Tom Lane
"Dhaval Shah" <[EMAIL PROTECTED]> writes: > What am I doing wrong? Lying to the server. If you don't have the requested file, return failure, don't invent something. There are a number of cases where the recovery process asks for files that are quite likely not to exist. > If I indicate that I

Re: [GENERAL] cache - timing

2007-03-20 Thread Vivek Khera
On Mar 19, 2007, at 1:58 AM, ab wrote: I am trying to measure the time taken for a number of queries using \timing . All queries on my table other than the first one are pretty fast. This is likely due to caching. Is there any way to clear the internal cache of Postgres. Should I be worried abo

Re: [GENERAL] Planner tuning

2007-03-20 Thread Dmitry Koterov
I don't know exactly is it your case, but sometimes SET enable_sort = off; speeds up some queries by the factor of hundred. But in some cases this command slows down operations, so I TEMPORARILY switch enable_sort on and off for some queries. It affects the query plan greatly. On 3/20/07, Alban

Re: [GENERAL] Reference Type in PostgreSQL

2007-03-20 Thread Merlin Moncure
On 3/19/07, Elena <[EMAIL PROTECTED]> wrote: Hello all, I'm new in PostgreSQL... I would want to know like PostgreSQL manages the type reference that defines the standard SQL:1999. I want to define the type of attribute like a reference at other type. For example, in Oracle8i the definition is

Re: [GENERAL] passing passords to pgsql/pg_create/pg_dump programmatically

2007-03-20 Thread Raymond O'Donnell
On 20/03/2007 14:04, Lars Haugseth wrote: As you can see, all of these command line utilities accept the -W parameter followed by the password. Correct me if I'm wrong, but doesn't -W simply force a prompt from the password? - it doesn't accept the password on the command line. Using the .p

Re: [GENERAL] passing passords to pgsql/pg_create/pg_dump programmatically

2007-03-20 Thread Lars Haugseth
* "filippo" <[EMAIL PROTECTED]> wrote: > > Hello, > > I have written a program perl/Tkprogram, based on postgres. For > maintenance reasons in my program I use these commands: > > `dropdb -U postgres -h $BACKUP_SERVER $BACKUP_DATABASE_NAME`; > `createdb -U postgres -h $BACKUP_SERVER $

Re: [GENERAL] Planner tuning

2007-03-20 Thread Alban Hertroys
Tom Lane wrote: > Alban Hertroys <[EMAIL PROTECTED]> writes: >> It seems pretty obvious that the planner underestimates the cost of >> nestloops here, is there some way to tweak this? > > The real problem is the factor-of-a-thousand underestimate of the size > of this join: Good observation, I mi

Re: [GENERAL] TSearch2 Problems

2007-03-20 Thread Howard Cole
Hi Oleg, Everything seemed to work after the vacuum. Thanks for your prompt response. Howard ---(end of broadcast)--- TIP 6: explain analyze is your friend