[GENERAL] UTF-8 encoding problem

2007-08-15 Thread bhyuan
hi I use UTF-8 as server character encoding, and use sjis as client character encoding. For some reason, some none sjis encoding character was insert into the database. WHEN I use set client_encoding='SJIS select * from xxx I got such error message Native Error: ERROR: character 0xc2a0 of encoding

[GENERAL] PostgreSQL clustering (shared disk)

2007-08-15 Thread Mikko Partio
Hello list, I have a mission to implement a two-node active-passive PostgreSQL cluster. The databases at the cluster are rather large (hundreds of GB's) which opts me to consider a shared disk environment. I know this is not natively supported with PostgreSQL, but I have been investigating the Red

Re: [GENERAL] memory optimization

2007-08-15 Thread Sabin Coanda
>> >> So, what is better from the postgres memory point of view: to use >> temporary >> objects, or to use common variables ? > >A temp table might take *slightly* more room than variables... > >> Can you suggest me other point of views to be taken into consideration in >> my >> case ? > >Code ma

Re: [GENERAL] Fastest way to import only ONE column into a table? (COPY doesn't work)

2007-08-15 Thread Phoenix Kiula
On 16/08/07, Rodrigo De León <[EMAIL PROTECTED]> wrote: > On Aug 15, 11:46 pm, [EMAIL PROTECTED] ("Phoenix Kiula") wrote: > > Appreciate any tips, because it would > > be nasty to have to do this with millions of UPDATE statements! > > - Create an interim table > - COPY the data into it > - Do an U

Re: [GENERAL] language interface in postgresql

2007-08-15 Thread David Fetter
On Wed, Aug 15, 2007 at 01:10:15AM -0400, Tom Lane wrote: > "Scott Marlowe" <[EMAIL PROTECTED]> writes: > > On 8/14/07, Tom Lane <[EMAIL PROTECTED]> wrote: > >> ... I think we probably are unique in being so aggressively > >> agnostic about what the function language is. That's not > >> necessari

Re: [GENERAL] SELECT ... FOR UPDATE performance costs? alternatives?

2007-08-15 Thread Tom Lane
"D. Dante Lorenso" <[EMAIL PROTECTED]> writes: > ... When my server is under severe load, however, this function begins to > take a long time to execute and I begin to suspect that the FOR UPDATE > lock might be locking the whole table and not just the row. FOR UPDATE only locks the selected row

Re: [GENERAL] User-Friendly TimeZone List

2007-08-15 Thread Tom Lane
Naz Gassiep <[EMAIL PROTECTED]> writes: > 1. The timezone list there isn't exactly user friendly, there are many > Etc/* timezones there, as well as others that would be potentially > confusing for users who are trying to select the timezone they are in. Feel free to filter things you don't thin

Re: [GENERAL] Deadlocks caused by a foreign key constraint

2007-08-15 Thread Tom Lane
Decibel! <[EMAIL PROTECTED]> writes: > But... taking a quick look at RI_FKey_check in backend/utils/adt/ > ri_triggers.c, I don't see it checking to see if the FK has changed, > which seems odd. I would think that if the FK fields haven't changed > that there's no need to perform the check. Y

Re: [GENERAL] Fastest way to import only ONE column into a table? (COPY doesn't work)

2007-08-15 Thread Rodrigo De León
On Aug 15, 11:46 pm, [EMAIL PROTECTED] ("Phoenix Kiula") wrote: > Appreciate any tips, because it would > be nasty to have to do this with millions of UPDATE statements! - Create an interim table - COPY the data into it - Do an UPDATE ... FROM ... ---(end of broadcast)---

[GENERAL] Fastest way to import only ONE column into a table? (COPY doesn't work)

2007-08-15 Thread Phoenix Kiula
What is the fastest way to import the values of *only one* column into an already existing table? Say the table looks like this: id (primary key) description created_on I want to import only a new column so the table looks like this: id (primary key) title description created_on S

Re: [GENERAL] Interpreting statistics collector output

2007-08-15 Thread Decibel!
On Aug 15, 2007, at 2:11 PM, Gregory Stark wrote: "Decibel!" <[EMAIL PROTECTED]> writes: On Wed, Aug 15, 2007 at 01:26:02PM -0400, Steve Madsen wrote: On Aug 15, 2007, at 11:52 AM, Decibel! wrote: I can't really think of a case where a seqscan wouldn't return all the rows in the table... tha

Re: [GENERAL] User-Friendly TimeZone List

2007-08-15 Thread Naz Gassiep
Do the views in 8.2 pg_timezone_abbrevs and pg_timezone_names help at all? They are where I am currently getting the authoritative list of timezones. However this list does not seem to be quite appropriate to expose users to directly. Read my original post, I've explained it a little more

Re: [GENERAL] Deadlocks caused by a foreign key constraint

2007-08-15 Thread Decibel!
On Aug 15, 2007, at 1:27 PM, Dmitry Koterov wrote: I have tested all cases, the code I quoted is complete and minimal. All operations are non-blocking (count incrementation is non- blocking, insertion with a foreign key is non-blocking too), but it still generates a deadlock time to time. Del

Re: [GENERAL] Writing most code in Stored Procedures

2007-08-15 Thread Steve Manes
Trevor Talbot wrote: Another is because I want transactions to start and end in the database, not in external application code which might crash before a COMMIT. Hmm, how do you handle this logically? Do your applications never need to submit chunks of work at once? Or do you do something lik

Re: [GENERAL] please! SPI_finish is strange

2007-08-15 Thread Tom Lane
"=?EUC-KR?B?vK2x4ryu?="<[EMAIL PROTECTED]> writes: > Please help me to solve the problem.(Sorry, I'm not good at english > speeking) This code has no chance of working --- you cannot hold an SPI context open across multiple calls to an SRF. Run the SPI query to completion during the FIRSTCALL se

Re: [GENERAL] SELECT ... FOR UPDATE performance costs? alternatives?

2007-08-15 Thread D. Dante Lorenso
Erik Jones wrote: On Aug 15, 2007, at 2:39 PM, [EMAIL PROTECTED] wrote: Erik Jones wrote: On Aug 15, 2007, at 1:09 PM, D. Dante Lorenso wrote: ...to ensure that only one server is processing the queue item, so inside PGSQL, use SELECT ... FOR UPDATE to lock the row... When my server is unde

[GENERAL] please! SPI_finish is strange

2007-08-15 Thread 서기석
this source is strange,   when I uncomment code(1), and compile, and, run query   d_cppschool=> SELECT * FROM UC_ExecWithNo('SELECT I_IDNum,I_UserID FROM DI_ID',10,10,3) as T(T1 int,T2 bigint,T3 CHAR(20))   and I get result :  WARNING: transaction left non-empty SPI stack Hint: Check for missing "S

Re: [GENERAL] Writing most code in Stored Procedures

2007-08-15 Thread Trevor Talbot
On 8/15/07, Steve Manes <[EMAIL PROTECTED]> wrote: > I'm fairly hardcore about keeping as much business logic as I can in the > database. In fact, I only do SELECTs from the application, and usually > via Views. All inserts, updates and deletes are via procs. I'm a > proponent of separating app

Re: [GENERAL] pg_dump on local Windows, pg_restore on Linux?

2007-08-15 Thread Phoenix Kiula
On 16/08/07, James B. Byrne <[EMAIL PROTECTED]> wrote: > > Date: Wed, 15 Aug 2007 20:31:45 +0200 > From: "Leif B. Kristensen" <[EMAIL PROTECTED]> > To: pgsql-general@postgresql.org > Subject: Re: pg_dump on local Windows, pg_restore on Linux? > Message-ID: <[EMAIL PROTECTED]> > > On Wednesday 15. A

Re: [GENERAL] Writing most code in Stored Procedures

2007-08-15 Thread Steve Manes
On 8/15/07, Rohit <[EMAIL PROTECTED]> wrote: I have few queries regarding the use of Stored Procedures, Functions and Triggers in an RDBMS. (1) When to use Stored Procedure? Writing an INSERT query in a Stored Procedure is better or firing it from the application level? (2) Can a Trigger call a

Re: [GENERAL] Trigger Procedure Error: NEW used in query that is not in a rule

2007-08-15 Thread Javier Fonseca V.
The first time that I read it, the work-around sounded a little odd (extreme!) to me... but actually it would really work!. Thanks for the tip :) *Javier* On 8/15/07, Decibel! <[EMAIL PROTECTED]> wrote: > > On Sat, Aug 11, 2007 at 02:43:30AM -0500, Javier Fonseca V. wrote: > > Hello. > > > > I'

Re: [GENERAL] Writing most code in Stored Procedures

2007-08-15 Thread Josh Tolley
On 8/15/07, Rohit <[EMAIL PROTECTED]> wrote: > I have few queries regarding the use of Stored Procedures, Functions > and Triggers in an RDBMS. > > (1) When to use Stored Procedure? Writing an INSERT query in a Stored > Procedure is better or firing it from the application level? > > (2) Can a Trig

Re: [GENERAL] language interface in postgresql

2007-08-15 Thread Josh Tolley
On 8/15/07, Magnus Hagander <[EMAIL PROTECTED]> wrote: > Trevor Talbot wrote: > > On 8/14/07, Jasbinder Singh Bali <[EMAIL PROTECTED]> wrote: > > > >> Let me fine tune my question here. What I mean to say is the way we can > >> write stored procedures in C, perl etc in Postgres specifying the langu

Re: [GENERAL] pg_dump on local Windows, pg_restore on Linux?

2007-08-15 Thread James B. Byrne
Date: Wed, 15 Aug 2007 20:31:45 +0200 From: "Leif B. Kristensen" <[EMAIL PROTECTED]> To: pgsql-general@postgresql.org Subject: Re: pg_dump on local Windows, pg_restore on Linux? Message-ID: <[EMAIL PROTECTED]> On Wednesday 15. August 2007, Phoenix Kiula wrote: > >This is great info, thanks. Could

Re: [GENERAL] SELECT ... FOR UPDATE performance costs? alternatives?

2007-08-15 Thread Erik Jones
On Aug 15, 2007, at 2:39 PM, [EMAIL PROTECTED] wrote: Erik Jones wrote: On Aug 15, 2007, at 1:09 PM, D. Dante Lorenso wrote: ...to ensure that only one server is processing the queue item, so inside PGSQL, use SELECT ... FOR UPDATE to lock the row... When my server is under severe load, how

Re: [GENERAL] User-Friendly TimeZone List

2007-08-15 Thread A.M.
On Aug 15, 2007, at 13:27 , Naz Gassiep wrote: Hi all, I am still, after quite some time, wrangling over the time zone system in my app. I have sorted out all the internal handling, however I am still uncertain as to what the best way to get the user to select their time zone is.

Re: [GENERAL] SELECT ... FOR UPDATE performance costs? alternatives?

2007-08-15 Thread btober
Erik Jones wrote: On Aug 15, 2007, at 1:09 PM, D. Dante Lorenso wrote: ...to ensure that only one server is processing the queue item, so inside PGSQL, use SELECT ... FOR UPDATE to lock the row... When my server is under severe load, however, this function begins to take a long time to execu

Re: [GENERAL] SELECT ... FOR UPDATE performance costs? alternatives?

2007-08-15 Thread Erik Jones
On Aug 15, 2007, at 1:09 PM, D. Dante Lorenso wrote: All, I have a stored procedure that I use to manage a queue. I want to pop an item off the queue to ensure that only one server is processing the queue item, so inside PGSQL, use SELECT ... FOR UPDATE to lock the row. Here's how I pop

Re: [GENERAL] Interpreting statistics collector output

2007-08-15 Thread Gregory Stark
"Decibel!" <[EMAIL PROTECTED]> writes: > On Wed, Aug 15, 2007 at 01:26:02PM -0400, Steve Madsen wrote: >> On Aug 15, 2007, at 11:52 AM, Decibel! wrote: >> >I can't really think of a case where a seqscan wouldn't return all the >> >rows in the table... that's what it's meant to do. LIMIT -- Gr

Re: [GENERAL] MVCC cons

2007-08-15 Thread Scott Marlowe
On 8/15/07, Jeff Davis <[EMAIL PROTECTED]> wrote: > On Wed, 2007-08-15 at 07:06 +0530, Merlin Moncure wrote: > > You were half right. Inserts in PostgreSQL perform similar to other > > databases (or at least, use similar mechanisms). It's the updates > > that suffer, because this translates to de

Re: [GENERAL] Best practice for: ERROR: invalid byte sequence for encoding "UTF8"

2007-08-15 Thread Martijn van Oosterhout
On Thu, Aug 16, 2007 at 01:56:52AM +0800, Phoenix Kiula wrote: > This is very useful, thanks. This would be "bytea"? Quick questions: > > 1. Even if it were bytea, would it work with regular SQL operators > such as regexp and LIKE? bytea is specifically designed for binary data, as such it has al

Re: [GENERAL] MVCC cons

2007-08-15 Thread Jeff Davis
On Wed, 2007-08-15 at 07:06 +0530, Merlin Moncure wrote: > You were half right. Inserts in PostgreSQL perform similar to other > databases (or at least, use similar mechanisms). It's the updates > that suffer, because this translates to delete + insert essentially. > Databases that use simple loc

[GENERAL] SELECT ... FOR UPDATE performance costs? alternatives?

2007-08-15 Thread D. Dante Lorenso
All, I have a stored procedure that I use to manage a queue. I want to pop an item off the queue to ensure that only one server is processing the queue item, so inside PGSQL, use SELECT ... FOR UPDATE to lock the row. Here's how I pop the queue item: ---

Re: [GENERAL] pg_dump on local Windows, pg_restore on Linux?

2007-08-15 Thread Leif B. Kristensen
On Wednesday 15. August 2007, Phoenix Kiula wrote: >> At least on a *nix system, collation is based on the value of the >> LC_ALL environment variable at dbinit time. There's nothing you can >> do about it in a live database. IMO that's a little awkward, and is >> what finally made me change the gl

Re: [GENERAL] Trigger Procedure Error: NEW used in query that is not in a rule

2007-08-15 Thread Decibel!
On Sat, Aug 11, 2007 at 02:43:30AM -0500, Javier Fonseca V. wrote: > Hello. > > I'm doing a Trigger Procedure in pl/pgSQL. It makes some kind of auditing. > > I think that it's working alright except for the next line: > > EXECUTE 'INSERT INTO ' || quote_ident(somedynamictablename) || ' SELECT

Re: [GENERAL] Deadlocks caused by a foreign key constraint

2007-08-15 Thread Dmitry Koterov
No. I have tested all cases, the code I quoted is complete and minimal. All operations are non-blocking (count incrementation is non-blocking, insertion with a foreign key is non-blocking too), but it still generates a deadlock time to time. Deletion of the foreign key constraint completely solves

Re: [GENERAL] Interpreting statistics collector output

2007-08-15 Thread Decibel!
On Wed, Aug 15, 2007 at 01:26:02PM -0400, Steve Madsen wrote: > On Aug 15, 2007, at 11:52 AM, Decibel! wrote: > >I can't really think of a case where a seqscan wouldn't return all the > >rows in the table... that's what it's meant to do. > > Isn't a sequential scan the only option if an appropriat

Re: [GENERAL] memory optimization

2007-08-15 Thread Decibel!
On Wed, Aug 15, 2007 at 10:21:31AM +0300, Sabin Coanda wrote: > Hi there, > > I have a procedure which uses temporary objects (table and sequence). I > tried to optimize it, using common variables (array and long varchar) > instead. I didn't found any difference in performance, but I'd like to

Re: [GENERAL] Yet Another COUNT(*)...WHERE...question

2007-08-15 Thread Andrew Armstrong
I don't know how PSQL does it, but MySQL has an SQL_CALC_FOUND_ROWS extension which allows the query to also return how many rows exist without the LIMIT clause. Perhaps there is similar for PSQL (check LIMIT docs?) - Andrew -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTEC

Re: [GENERAL] pg_dump on local Windows, pg_restore on Linux?

2007-08-15 Thread Tom Lane
"Phoenix Kiula" <[EMAIL PROTECTED]> writes: > Thanks. Is there an encoding that is so flexible that it will silently > accept whatever I send to it without throwing an exception? SQL_ASCII does that. Whether it's a good idea to use it is questionable. One thing to think about is that you will be

Re: [GENERAL] Best practice for: ERROR: invalid byte sequence for encoding "UTF8"

2007-08-15 Thread Ben
On Thu, 16 Aug 2007, Phoenix Kiula wrote: 1. Even if it were bytea, would it work with regular SQL operators such as regexp and LIKE? 2. Would tsearch2 work with bytea in the future as long as the stuff in it was text? As far as I know, regexp, [i]like, tsearch2, etc. all require valid text

Re: [GENERAL] pg_dump on local Windows, pg_restore on Linux?

2007-08-15 Thread Phoenix Kiula
> At least on a *nix system, collation is based on the value of the LC_ALL > environment variable at dbinit time. There's nothing you can do about > it in a live database. IMO that's a little awkward, and is what finally > made me change the global from ISO-8859-1 to UTF-8 on my three Gentoo > Linu

Re: [GENERAL] Copy command and duplicate items (Support Replace?)

2007-08-15 Thread Decibel!
On Tue, Aug 14, 2007 at 10:50:33AM +0800, Ow Mun Heng wrote: > Hi, > > Writing a script to pull data from SQL server into a flat-file (or just > piped in directly to PG using Perl DBI) > > Just wondering if the copy command is able to do a replace if there are > existing data in the Db already. (

Re: [GENERAL] Best practice for: ERROR: invalid byte sequence for encoding "UTF8"

2007-08-15 Thread Phoenix Kiula
On 16/08/07, Phoenix Kiula <[EMAIL PROTECTED]> wrote: > On 16/08/07, Ben <[EMAIL PROTECTED]> wrote: > > On Thu, 16 Aug 2007, Phoenix Kiula wrote: > > > > > I am not advocating what others should do. But I know what I need my > > > DB to do. If I want it to store data that does not match puritanical

Re: [GENERAL] Best practice for: ERROR: invalid byte sequence for encoding "UTF8"

2007-08-15 Thread Phoenix Kiula
On 16/08/07, Ben <[EMAIL PROTECTED]> wrote: > On Thu, 16 Aug 2007, Phoenix Kiula wrote: > > > I am not advocating what others should do. But I know what I need my > > DB to do. If I want it to store data that does not match puritanical > > standards of textual storage, then it should allow me to...

Re: [GENERAL] pg_dump on local Windows, pg_restore on Linux?

2007-08-15 Thread Leif B. Kristensen
On Wednesday 15. August 2007, Phoenix Kiula wrote: >Couple of questions with porting: > >1. I have been playing around with my databases locally on Win XP so >as not to hurt our website traffic. Now I would like to move the >database to a Linux CentOS server. Can I use pg_dump on Windows and >pg_re

Re: [GENERAL] pg_dump on local Windows, pg_restore on Linux?

2007-08-15 Thread Phoenix Kiula
On 16/08/07, Scott Marlowe <[EMAIL PROTECTED]> wrote: > On 8/15/07, Phoenix Kiula <[EMAIL PROTECTED]> wrote: > > Couple of questions with porting: > > > > 1. I have been playing around with my databases locally on Win XP so > > as not to hurt our website traffic. Now I would like to move the > > da

Re: [GENERAL] pqlib in c++: PQconnectStart PQconnectPoll

2007-08-15 Thread madhtr
- Original Message - From: "madhtr" <[EMAIL PROTECTED]> To: "Tom Lane" <[EMAIL PROTECTED]> Cc: Sent: Wednesday, February 14, 2007 22:33 Subject: Re: [GENERAL] pqlib in c++: PQconnectStart PQconnectPoll Another line of thought, given the reading-between-the-lines conclusion that you a

Re: [GENERAL] User-Friendly TimeZone List

2007-08-15 Thread Scott Marlowe
On 8/15/07, Naz Gassiep <[EMAIL PROTECTED]> wrote: > Hi all, > I am still, after quite some time, wrangling over the time zone > system in my app. I have sorted out all the internal handling, however I > am still uncertain as to what the best way to get the user to select > their time zone is.

Re: [GENERAL] Best practice for: ERROR: invalid byte sequence for encoding "UTF8"

2007-08-15 Thread Ben
On Thu, 16 Aug 2007, Phoenix Kiula wrote: I am not advocating what others should do. But I know what I need my DB to do. If I want it to store data that does not match puritanical standards of textual storage, then it should allow me to... It does allow that: store it as a BLOB, and then treat

Re: [GENERAL] pg_dump on local Windows, pg_restore on Linux?

2007-08-15 Thread Scott Marlowe
On 8/15/07, Phoenix Kiula <[EMAIL PROTECTED]> wrote: > Couple of questions with porting: > > 1. I have been playing around with my databases locally on Win XP so > as not to hurt our website traffic. Now I would like to move the > database to a Linux CentOS server. Can I use pg_dump on Windows and

Re: [GENERAL] Best practice for: ERROR: invalid byte sequence for encoding "UTF8"

2007-08-15 Thread Scott Marlowe
On 8/15/07, Phoenix Kiula <[EMAIL PROTECTED]> wrote: > > What, exactly, does that mean? > > > > That PostgreSQL should take things in invalid utf-8 format and just store > > them? > > Or that PostgreSQL should autoconvert from invalid utf-8 to valid > > utf-8, guessing the proper codes? > > > > Se

Re: [GENERAL] Best practice for: ERROR: invalid byte sequence for encoding "UTF8"

2007-08-15 Thread Phoenix Kiula
> What, exactly, does that mean? > > That PostgreSQL should take things in invalid utf-8 format and just store > them? > Or that PostgreSQL should autoconvert from invalid utf-8 to valid > utf-8, guessing the proper codes? > > Seriously, what do you want pgsql to do with these invalid inputs? PG

Re: [GENERAL] Best practice for: ERROR: invalid byte sequence for encoding "UTF8"

2007-08-15 Thread Scott Marlowe
On 8/15/07, Phoenix Kiula <[EMAIL PROTECTED]> wrote: > On 15/08/07, Ivan Zolotukhin <[EMAIL PROTECTED]> wrote: > > Hello, > > > > Actually I tried smth like $str = @iconv("UTF-8", "UTF-8//IGNORE", > > $str); when preparing string for SQL query and it worked. There's > > probably a better way in PHP

[GENERAL] User-Friendly TimeZone List

2007-08-15 Thread Naz Gassiep
Hi all, I am still, after quite some time, wrangling over the time zone system in my app. I have sorted out all the internal handling, however I am still uncertain as to what the best way to get the user to select their time zone is. I was thinking of having users just select their time

Re: [GENERAL] Interpreting statistics collector output

2007-08-15 Thread Steve Madsen
On Aug 15, 2007, at 11:52 AM, Decibel! wrote: I can't really think of a case where a seqscan wouldn't return all the rows in the table... that's what it's meant to do. Isn't a sequential scan the only option if an appropriate index does not exist? E.g., for a query with a WHERE clause, but n

[GENERAL] pg_dump on local Windows, pg_restore on Linux?

2007-08-15 Thread Phoenix Kiula
Couple of questions with porting: 1. I have been playing around with my databases locally on Win XP so as not to hurt our website traffic. Now I would like to move the database to a Linux CentOS server. Can I use pg_dump on Windows and pg_restore it on Linux? If so, any tips on what I should keep

Re: [GENERAL] Select time jump after adding filter; please help me figure out what I'm doing wrong.

2007-08-15 Thread Richard Huxton
Andrew Edson wrote: Yes. The only difference between the two selects was that the index on the table in question was dropped. As far as I know, that was the only partial index on there, although since it's a test db, I could probably go in and experiment on a few more if needed. This problem m

Re: [GENERAL] Select time jump after adding filter; please help me figure out what I'm doing wrong.

2007-08-15 Thread Andrew Edson
Tom Lane <[EMAIL PROTECTED]> wrote: Ah. I think your result is explained by this 8.1.4 bug fix: 2006-05-18 14:57 tgl * src/backend/optimizer/plan/createplan.c (REL8_1_STABLE): When a bitmap indexscan is using a partial index, it is necessary to include the partial index predicate in the scan'

Re: [GENERAL] Best practice for: ERROR: invalid byte sequence for encoding "UTF8"

2007-08-15 Thread Phoenix Kiula
On 15/08/07, Ivan Zolotukhin <[EMAIL PROTECTED]> wrote: > Hello, > > Actually I tried smth like $str = @iconv("UTF-8", "UTF-8//IGNORE", > $str); when preparing string for SQL query and it worked. There's > probably a better way in PHP to achieve this: simply change default > values in php.ini for t

Re: [GENERAL] Select time jump after adding filter; please help me figure out what I'm doing wrong.

2007-08-15 Thread Tom Lane
Andrew Edson <[EMAIL PROTECTED]> writes: > This problem may have already been solved; I'm using an older > version of Postgres; 8.1.3. Ah. I think your result is explained by this 8.1.4 bug fix: 2006-05-18 14:57 tgl * src/backend/optimizer/plan/createplan.c (REL8_1_STABLE): When a

Re: [GENERAL] is this trigger safe and efective? - locking (caching via triiggers)

2007-08-15 Thread Erik Jones
On Aug 15, 2007, at 11:14 AM, Pavel Stehule wrote: 2007/8/15, Erik Jones <[EMAIL PROTECTED]>: On Aug 15, 2007, at 4:57 AM, Pavel Stehule wrote: I write sample about triggers and i have question. is my solution correct and exists better solution? Regards Pavel Stehule DROP SCHEMA safecache C

Re: [GENERAL] Select time jump after adding filter; please help me figure out what I'm doing wrong.

2007-08-15 Thread Andrew Edson
Yes. The only difference between the two selects was that the index on the table in question was dropped. As far as I know, that was the only partial index on there, although since it's a test db, I could probably go in and experiment on a few more if needed. This problem may have alread

Re: [GENERAL] Select time jump after adding filter; please help me figure out what I'm doing wrong.

2007-08-15 Thread Richard Huxton
Andrew Edson wrote: I apologize about the CC; I thought I had done so. no problem There are fourteen (14) distinct values in rcrd_cd. And I don't know if this counts as something odd, but I got the following values by doing a vacuum full analyze, then running the set with index, dropping ind

Re: [GENERAL] is this trigger safe and efective? - locking (caching via triiggers)

2007-08-15 Thread Pavel Stehule
2007/8/15, Erik Jones <[EMAIL PROTECTED]>: > On Aug 15, 2007, at 4:57 AM, Pavel Stehule wrote: > > > I write sample about triggers and i have question. is my solution > > correct and exists better solution? > > > > Regards > > Pavel Stehule > > > > DROP SCHEMA safecache CASCADE; > > > > CREATE SCHE

Re: [GENERAL] Performance check of my database

2007-08-15 Thread Decibel!
On Sun, Aug 12, 2007 at 05:40:26PM -0400, Harpreet Dhaliwal wrote: > Hi, > > Lately I completed the business logic of my application and all related > database work. > > Now i need to check the performance of my database, how much load it can > bear, perfomance to different queries and stored pro

Re: [GENERAL] Deadlocks caused by a foreign key constraint

2007-08-15 Thread Decibel!
On Fri, Aug 10, 2007 at 09:38:36PM +0400, Dmitry Koterov wrote: > Hello. > > I have a number of deadlock because of the foreign key constraint: > > Assume we have 2 tables: A and B. Table A has a field fk referenced to > B.idas a foreign key constraint. > > > -- transaction #1 > BEGIN; > ... >

Re: [GENERAL] Yet Another COUNT(*)...WHERE...question

2007-08-15 Thread Erik Jones
On Aug 15, 2007, at 9:36 AM, Phoenix Kiula wrote: I'm grappling with a lot of reporting code for our app that relies on queries such as: SELECT COUNT(*) FROM TABLE WHERE (conditions)... And I still do not find, from the discussions on this thread, any truly viable solution for this. T

Re: [GENERAL] Yet Another COUNT(*)...WHERE...question

2007-08-15 Thread Bill Moran
In response to "Phoenix Kiula" <[EMAIL PROTECTED]>: > > Yes, optimization. :) You don't need an exact count to tell someone > > that there's more data and they can go to it. > > > In general, I agree. But my example of Amazon was only to illustrate > the point about two queries and why they may

Re: [GENERAL] Cluster and MVCC

2007-08-15 Thread Decibel!
On Fri, Aug 10, 2007 at 06:34:03PM +0100, Simon Riggs wrote: > On Fri, 2007-08-10 at 10:02 -0400, Brad Nicholson wrote: > > I just want to confirm that the cluster/MVCC issues are due to > > transaction visibility. Assuming that no concurrent access is happening > > to a given table when the clust

Re: [GENERAL] Customizing psql console to show execution times

2007-08-15 Thread Tom Lane
Richard Broersma Jr <[EMAIL PROTECTED]> writes: > However, notice that "\timing" and > explain analyze do not exactly agree on the results they produce. \timing reports the total elapsed time as seen at the client. EXPLAIN ANALYZE tells you about the query execution path inside the server; so it

Re: [GENERAL] Best practice for: ERROR: invalid byte sequence for encoding "UTF8"

2007-08-15 Thread Vivek Khera
On Aug 15, 2007, at 7:41 AM, Ivan Zolotukhin wrote: What is the best practice to process such a broken strings before passing them to PostgreSQL? Iconv from utf-8 to utf-8 dropping bad characters? This rings of GIGO... if your user enters garbage, how do you know what they wanted? You don'

Re: [GENERAL] Customizing psql console to show execution times

2007-08-15 Thread Phoenix Kiula
> I think you're looking for the \timing command? > http://www.postgresql.org/docs/8.2/static/app-psql.html > (under meta-commands, about halfway down the page) Thanks everyone. "\timing" it is! Happy camper. ---(end of broadcast)--- TIP 5: don't

Re: [GENERAL] Select time jump after adding filter; please help me figure out what I'm doing wrong.

2007-08-15 Thread Andrew Edson
I apologize about the CC; I thought I had done so. There are fourteen (14) distinct values in rcrd_cd. And I don't know if this counts as something odd, but I got the following values by doing a vacuum full analyze, then running the set with index, dropping index, running set without.

Re: [GENERAL] Interpreting statistics collector output

2007-08-15 Thread Decibel!
On Thu, Aug 09, 2007 at 09:14:55PM -0400, Steve Madsen wrote: > On Aug 8, 2007, at 6:08 PM, Decibel! wrote: > >Something else I like to look at is pg_stat_all_tables seq_scan and > >seq_tup_read. If seq_scan is a large number and seq_tup_read/ > >seq_scan is > >also large, that indicates that you

Re: [GENERAL] Permission ALTER PASSWORD

2007-08-15 Thread Decibel!
On Wed, Aug 08, 2007 at 06:35:51PM -0300, Anderson Alves de Albuquerque wrote: > After user $USER execute this ALTER, it get change PASSWORD. Could I block > command ALTER password to user $USER? No, there's no way to do that. You might want to look at using ident-based authentication for that u

Re: [GENERAL] is this trigger safe and efective? - locking (caching via triiggers)

2007-08-15 Thread Erik Jones
On Aug 15, 2007, at 4:57 AM, Pavel Stehule wrote: I write sample about triggers and i have question. is my solution correct and exists better solution? Regards Pavel Stehule DROP SCHEMA safecache CASCADE; CREATE SCHEMA safecache; CREATE TABLE safecache.source_tbl(category int, int_value int)

Re: [GENERAL] Customizing psql console to show execution times

2007-08-15 Thread Tom Lane
"Phoenix Kiula" <[EMAIL PROTECTED]> writes: > In some examples posted to this forum, it seems to me that when people > execute queries in the psql window, they also see "90 ms taken" > (milliseconds), which denotes the time taken to execute the query. > Where can I set this option because I'm not s

Re: [GENERAL] Customizing psql console to show execution times

2007-08-15 Thread Scott Marlowe
On 8/15/07, Phoenix Kiula <[EMAIL PROTECTED]> wrote: > In some examples posted to this forum, it seems to me that when people > execute queries in the psql window, they also see "90 ms taken" > (milliseconds), which denotes the time taken to execute the query. > Where can I set this option because

Re: [GENERAL] Customizing psql console to show execution times

2007-08-15 Thread Leif B. Kristensen
On Wednesday 15. August 2007, Phoenix Kiula wrote: >In some examples posted to this forum, it seems to me that when people >execute queries in the psql window, they also see "90 ms taken" >(milliseconds), which denotes the time taken to execute the query. >Where can I set this option because I'm no

Re: [GENERAL] Yet Another COUNT(*)...WHERE...question

2007-08-15 Thread Phoenix Kiula
> Yes, optimization. :) You don't need an exact count to tell someone > that there's more data and they can go to it. In general, I agree. But my example of Amazon was only to illustrate the point about two queries and why they may be needed. I seem to see many more pages than you do, but in any

Re: [GENERAL] Customizing psql console to show execution times

2007-08-15 Thread Richard Broersma Jr
--- Phoenix Kiula <[EMAIL PROTECTED]> wrote: > In some examples posted to this forum, it seems to me that when people > execute queries in the psql window, they also see "90 ms taken" > (milliseconds), which denotes the time taken to execute the query. > Where can I set this option because I'm no

Re: [GENERAL] Yet Another COUNT(*)...WHERE...question

2007-08-15 Thread Phoenix Kiula
On 15/08/07, Scott Marlowe <[EMAIL PROTECTED]> wrote: > On 8/15/07, Phoenix Kiula <[EMAIL PROTECTED]> wrote: > > On 15/08/07, Gregory Stark <[EMAIL PROTECTED]> wrote: > > > "Phoenix Kiula" <[EMAIL PROTECTED]> writes: > > > > > > > I'm grappling with a lot of reporting code for our app that relies o

Re: [GENERAL] Yet Another COUNT(*)...WHERE...question

2007-08-15 Thread Richard Broersma Jr
--- Phoenix Kiula <[EMAIL PROTECTED]> wrote: > Sorry I was not clear. Imagine an Amazon.com search results page. It > has about 15 results on Page 1, then it shows "Page 1 of 190". I don't think that amazon or google really need to give an accurate count in determining an estimated number of pag

Re: [GENERAL] Yet Another COUNT(*)...WHERE...question

2007-08-15 Thread Scott Marlowe
On 8/15/07, Phoenix Kiula <[EMAIL PROTECTED]> wrote: > On 15/08/07, Scott Marlowe <[EMAIL PROTECTED]> wrote: > > On 8/15/07, Phoenix Kiula <[EMAIL PROTECTED]> wrote: > > > On 15/08/07, Gregory Stark <[EMAIL PROTECTED]> wrote: > > > > "Phoenix Kiula" <[EMAIL PROTECTED]> writes: > > > > > > > > > I'm

[GENERAL] Customizing psql console to show execution times

2007-08-15 Thread Phoenix Kiula
In some examples posted to this forum, it seems to me that when people execute queries in the psql window, they also see "90 ms taken" (milliseconds), which denotes the time taken to execute the query. Where can I set this option because I'm not seeing it in my psql window on both Win XP and Linux.

Re: [GENERAL] check if database is correctly created

2007-08-15 Thread Tom Lane
"Alain Roger" <[EMAIL PROTECTED]> writes: > i would like to check (via PHP or C#) if my database has been correctly > created. > for that i use the following SQL : > select * from pg_tables where tablename = 'xxx' AND schemaname = 'yyy'; > this i repeat till i check all tables. > But how to check s

Re: [GENERAL] Yet Another COUNT(*)...WHERE...question

2007-08-15 Thread Richard Broersma Jr
--- Scott Marlowe <[EMAIL PROTECTED]> wrote: > Generally, for these kinds of things it's often best to use > materialized views / rollup tables so that you aren't re-aggregating > the same data over and over. I don't know if this was already mentioned, but here is one of the links that describe t

Re: [GENERAL] Yet Another COUNT(*)...WHERE...question

2007-08-15 Thread Scott Marlowe
On 8/15/07, Phoenix Kiula <[EMAIL PROTECTED]> wrote: > On 15/08/07, Gregory Stark <[EMAIL PROTECTED]> wrote: > > "Phoenix Kiula" <[EMAIL PROTECTED]> writes: > > > > > I'm grappling with a lot of reporting code for our app that relies on > > > queries such as: > > > > > > SELECT COUNT(*) FROM T

Re: [GENERAL] Yet Another COUNT(*)...WHERE...question

2007-08-15 Thread Richard Huxton
Phoenix Kiula wrote: SELECT COUNT(*) FROM TABLE WHERE (conditions)... I am not sure what the advice here is. The WHERE condition comes from the indices. So if the query was not "COUNT(*)" but just a couple of columns, the query executes in less than a second. Just that COUNT(*) become

Re: [GENERAL] Yet Another COUNT(*)...WHERE...question

2007-08-15 Thread Scott Marlowe
On 8/15/07, Phoenix Kiula <[EMAIL PROTECTED]> wrote: > I'm grappling with a lot of reporting code for our app that relies on > queries such as: > > SELECT COUNT(*) FROM TABLE WHERE (conditions)... > > And I still do not find, from the discussions on this thread, any > truly viable solution

Re: [GENERAL] Yet Another COUNT(*)...WHERE...question

2007-08-15 Thread Phoenix Kiula
On 15/08/07, Gregory Stark <[EMAIL PROTECTED]> wrote: > "Phoenix Kiula" <[EMAIL PROTECTED]> writes: > > > I'm grappling with a lot of reporting code for our app that relies on > > queries such as: > > > > SELECT COUNT(*) FROM TABLE WHERE (conditions)... > >... > > The number of such possib

Re: [GENERAL] Yet Another COUNT(*)...WHERE...question

2007-08-15 Thread Gregory Stark
"Phoenix Kiula" <[EMAIL PROTECTED]> writes: > I'm grappling with a lot of reporting code for our app that relies on > queries such as: > > SELECT COUNT(*) FROM TABLE WHERE (conditions)... >... > The number of such possibilities for multiple WHERE conditions is > infinite... Depends on th

[GENERAL] Yet Another COUNT(*)...WHERE...question

2007-08-15 Thread Phoenix Kiula
I'm grappling with a lot of reporting code for our app that relies on queries such as: SELECT COUNT(*) FROM TABLE WHERE (conditions)... And I still do not find, from the discussions on this thread, any truly viable solution for this. The one suggestion is to have a separate counts table,

Re: [GENERAL] Best practice for: ERROR: invalid byte sequence for encoding "UTF8"

2007-08-15 Thread Ivan Zolotukhin
Hello, Actually I tried smth like $str = @iconv("UTF-8", "UTF-8//IGNORE", $str); when preparing string for SQL query and it worked. There's probably a better way in PHP to achieve this: simply change default values in php.ini for these parameters: mbstring.encoding_translation = On mbstring.subst

Re: [GENERAL] Insert or Replace or \copy (bulkload)

2007-08-15 Thread Scott Marlowe
On 8/15/07, Gregory Stark <[EMAIL PROTECTED]> wrote: > "Tom Lane" <[EMAIL PROTECTED]> writes: > > I for one have a reputation of running spam filters that eat pets and small > > children ... so if you want to be sure to get through to me, don't forget to > > cc: the list. > > They eat all my emails

Re: [GENERAL] Compound Indexes

2007-08-15 Thread Phoenix Kiula
> you do a lot of queries like that and the id,s_id restriction isn't very > selective you might look into tsearch2 which can index that type of query. > Thanks. Does tsearch2 come installed with 8.2.3? I am not techie enough to do all the compiling stuff so I'm hoping it does! How can I check?

Re: [GENERAL] Best practice for: ERROR: invalid byte sequence for encoding "UTF8"

2007-08-15 Thread Ivan Zolotukhin
Hello, Well, PostgreSQL is correct entirely, I would post this message to the -hackers list otherwise :) The question was rather about application processing of user input not about change of database reaction on broken UTF-8 string. But I am 100% sure one should fix the input in this case since w

Re: [GENERAL] Transactional DDL

2007-08-15 Thread Martin Gainty
you can use SET TRANSACTION LEVEL READ UNCOMMITTED to acquire the dirty reads From your perspective how *should* the DB handle this? M This email message and any files transmitted with it contain confidential information intended only for the person(s) to whom this email message is addressed.

Re: [GENERAL] Writing most code in Stored Procedures

2007-08-15 Thread Richard Huxton
Rohit wrote: I have few queries regarding the use of Stored Procedures, Functions and Triggers in an RDBMS. These are all easy questions to answer: "it depends". OK, so you might want some reasons... (1) When to use Stored Procedure? Writing an INSERT query in a Stored Procedure is better or

  1   2   >