Re: [GENERAL] Migration from DB2 to PostgreSQL

2013-06-18 Thread Thomas Markus
Am 19.06.2013 08:05, schrieb sachin kotwal: While migrating my application from DB2 to PostgreSQL. I want to migrate following functions in PostgreSQL. Functions in DB2: BLOB()/CLOB() Criteria: Size of character string targeted for cast is more than 1GB. Character String as argument to this f

[GENERAL] Migration from DB2 to PostgreSQL

2013-06-18 Thread sachin kotwal
While migrating my application from DB2 to PostgreSQL. I want to migrate following functions in PostgreSQL. Functions in DB2: BLOB()/CLOB() Criteria: Size of character string targeted for cast is more than 1GB. Character String as argument to this function. How can I migrate this function in

[GENERAL] Finding the synchronous slave after a master crash

2013-06-18 Thread Sam Crawley
Hi, I was just wondering if there was a reliable way to find the synchronous slave if the master has crashed and is uncontactable. I believe the recommended way to find the new master in this situation is to poll the slaves, looking at the output of pg_last_xlog_replay_location(), and find wh

Re: [GENERAL] json functions

2013-06-18 Thread Michael Paquier
On Wed, Jun 19, 2013 at 2:00 PM, Jayadevan M wrote: > I have PostgreSQL 9.2.1. I can see a few json functions under pg_catalog, > json_send, for example. But I can’t find any documentation. Am I missing > something? I am sure you are looking for that: http://www.postgresql.org/docs/9.2/static/data

[GENERAL] json functions

2013-06-18 Thread Jayadevan M
Hi, I have PostgreSQL 9.2.1. I can see a few json functions under pg_catalog, json_send, for example. But I can't find any documentation. Am I missing something? Regards, Jayadevan DISCLAIMER: "The information in this e-mail and any attachment is intended only for the person to whom it is a

Re: [GENERAL] I want to make an example of using parameterized path

2013-06-18 Thread 高健
Thank you Jeff I tried on PostgreSQL 9.1.0, and found the running result is: postgres=# explain execute s(*2*); QUERY PLAN - Bitmap Heap Scan on tst01 t (cost=*626.59*.

Re: [GENERAL] Index over only uncommon values in table

2013-06-18 Thread David Johnston
Steven Schlansker-3 wrote > The code may get changed multiple times in the same day, if I am > busy hacking on it. On the production table??? The other thought-line is just use a (primary key, version) index and make use LIMIT / OFFSET with an ORDER BY on the PK and the filter on version AFTER th

Re: [GENERAL] Index over only uncommon values in table

2013-06-18 Thread Steven Schlansker
On Jun 18, 2013, at 2:29 PM, Jeff Janes wrote: > On Tue, Jun 18, 2013 at 12:17 PM, Steven Schlansker > wrote: > Hi everyone, > > I assume this is not easy with standard PG but I wanted to double check. > > I have a column that has a very uneven distribution of values. ~95% of the > values

Re: [GENERAL] Index over only uncommon values in table

2013-06-18 Thread Jeff Janes
On Tue, Jun 18, 2013 at 12:17 PM, Steven Schlansker wrote: > Hi everyone, > > I assume this is not easy with standard PG but I wanted to double check. > > I have a column that has a very uneven distribution of values. ~95% of > the values will be the same, with some long tail of another few dozen

Re: [GENERAL] Index over only uncommon values in table

2013-06-18 Thread Steven Schlansker
On Jun 18, 2013, at 1:49 PM, David Johnston wrote: > Steven Schlansker-3 wrote >> At some point, the code changes, and CURRENT_VERSION gets incremented. >> Rows then slowly (over a period of days / weeks) get "upgraded" to the new >> current version, in batches of thousands. >> >> This is what

[GENERAL] how to reference variables in pgbench custom scripts?

2013-06-18 Thread Lonni J Friedman
I'm attempting to write a custom pgbench script (called via the -f option), with a variable set at the top with: \setrandom aid 100 50875000 However, I can't quite figure out how to reference the new aid variable. The documentation simply states that a variable is referenced with a colon in front

Re: [GENERAL] Index over only uncommon values in table

2013-06-18 Thread David Johnston
Steven Schlansker-3 wrote > At some point, the code changes, and CURRENT_VERSION gets incremented. > Rows then slowly (over a period of days / weeks) get "upgraded" to the new > current version, in batches of thousands. > > This is what I mean by a very slowly changing mostly-constant value. Thi

Re: [GENERAL] Index over only uncommon values in table

2013-06-18 Thread David Johnston
Steven Schlansker-3 wrote > 1) The common value is not known at schema definition time, and may change > (very slowly) over time. > > 2) JDBC uses prepared statements for everything, and the value to be > selected is not known at statement prepare time, so any partial indices > are ignored (this i

Re: [GENERAL] Index over only uncommon values in table

2013-06-18 Thread Steven Schlansker
On Jun 18, 2013, at 12:23 PM, John R Pierce wrote: > On 6/18/2013 12:17 PM, Steven Schlansker wrote: >> 1) The common value is not known at schema definition time, and may change >> (very slowly) over time. > > how could a value thats constant in 95% of the rows change, unless you added > 20

Re: [GENERAL] earthdistance compass bearing

2013-06-18 Thread Steve Crawford
On 06/18/2013 11:16 AM, Jeff Herrin wrote: I don't need it to be too accurate. We're pushing hotel info into the GDS (sabre, expedia, orbitz, etc). They require airport info relative to the hotel. Example: DFW is 25 miles NW of the property. I thought about just faking it...comparing the hotel'

Re: [GENERAL] Index over only uncommon values in table

2013-06-18 Thread John R Pierce
On 6/18/2013 12:17 PM, Steven Schlansker wrote: 1) The common value is not known at schema definition time, and may change (very slowly) over time. how could a value thats constant in 95% of the rows change, unless you added 20 times more rows with a new value (and for a big portion of the t

[GENERAL] Index over only uncommon values in table

2013-06-18 Thread Steven Schlansker
Hi everyone, I assume this is not easy with standard PG but I wanted to double check. I have a column that has a very uneven distribution of values. ~95% of the values will be the same, with some long tail of another few dozens of values. I want to have an index over this value. Queries that

Re: [GENERAL] earthdistance compass bearing

2013-06-18 Thread John R Pierce
On 6/18/2013 11:16 AM, Jeff Herrin wrote: I don't need it to be too accurate. We're pushing hotel info into the GDS (sabre, expedia, orbitz, etc). They require airport info relative to the hotel. Example: DFW is 25 miles NW of the property. I thought about just faking it...comparing the hotel's

Re: [GENERAL] earthdistance compass bearing

2013-06-18 Thread Paul Ramsey
The code for azimuth on a sphere isn't so gnarly you couldn't whip it up in plpgsql, http://trac.osgeo.org/postgis/browser/trunk/liblwgeom/lwgeodetic.c#L924 P. -- Paul Ramsey http://cleverelephant.ca http://postgis.net On Tuesday, June 18, 2013 at 11:16 AM, Jeff Herrin wrote: > I don't ne

Re: [GENERAL] earthdistance compass bearing

2013-06-18 Thread Jeff Herrin
I don't need it to be too accurate. We're pushing hotel info into the GDS (sabre, expedia, orbitz, etc). They require airport info relative to the hotel. Example: DFW is 25 miles NW of the property. I thought about just faking it...comparing the hotel's lat/long from the airports. I can probably

Re: [GENERAL] earthdistance compass bearing

2013-06-18 Thread Merlin Moncure
On Tue, Jun 18, 2013 at 12:42 PM, Jeff Herrin wrote: > I'm trying to get a compass bearing (N,S,NW,etc) using earthdistance. I can > successfully get the distance between 2 points using either the point or > cube method, but I've been struggling with getting the bearing. Any tips? convert the cod

Re: [GENERAL] earthdistance compass bearing

2013-06-18 Thread Steve Crawford
On 06/18/2013 10:42 AM, Jeff Herrin wrote: I'm trying to get a compass bearing (N,S,NW,etc) using earthdistance. I can successfully get the distance between 2 points using either the point or cube method, but I've been struggling with getting the bearing. Any tips? PostGIS has some functions

Re: [GENERAL] earthdistance compass bearing

2013-06-18 Thread John R Pierce
On 6/18/2013 10:42 AM, Jeff Herrin wrote: I'm trying to get a compass bearing (N,S,NW,etc) using earthdistance. I can successfully get the distance between 2 points using either the point or cube method, but I've been struggling with getting the bearing. Any tips? calculating the angle betwee

Re: [GENERAL] Postgres DB crashing

2013-06-18 Thread John R Pierce
On 6/18/2013 10:31 AM, bhanu udaya wrote: My PostgresSQL (9.2) is crashing after certain load tests. Currently, postgressql is crashing when simulatenously 800 to 1000 threads are run on a 10 million records schema. Not sure, if we have to tweak some more parameters of postgres. Currently, the

[GENERAL] earthdistance compass bearing

2013-06-18 Thread Jeff Herrin
I'm trying to get a compass bearing (N,S,NW,etc) using earthdistance. I can successfully get the distance between 2 points using either the point or cube method, but I've been struggling with getting the bearing. Any tips? thanks, altimage

Re: [GENERAL] Postgres DB crashing

2013-06-18 Thread AI Rumman
Stop the autovacuum process and try again. On Tue, Jun 18, 2013 at 1:31 PM, bhanu udaya wrote: > Hello, > Greetings. > > My PostgresSQL (9.2) is crashing after certain load tests. Currently, > postgressql is crashing when simulatenously 800 to 1000 threads are run on > a 10 million records sche

[GENERAL] Postgres DB crashing

2013-06-18 Thread bhanu udaya
Hello, Greetings. My PostgresSQL (9.2) is crashing after certain load tests. Currently, postgressql is crashing when simulatenously 800 to 1000 threads are run on a 10 million records schema. Not sure, if we have to tweak some more parameters of postgres. Currently, the postgressql is config

Re: [GENERAL] I want to make an example of using parameterized path

2013-06-18 Thread Jeff Janes
On Tue, Jun 18, 2013 at 2:09 AM, 高健 wrote: > postgres=# explain execute s(2); > >QUERY PLAN > > - > > Index Only Scan using idx_tst01_id on tst01 t (cost=0.00..8.38 rows=1 > w

[GENERAL] Using functions to calc field values in other table

2013-06-18 Thread Robert Fitzpatrick
I was wondering if it is possible to store a function in a table for calculating a value for a field in another table. I am creating a sales quote tool where users can pick a service to add to the quote_services table when building the quote. I have a services table where some services have a

Re: [GENERAL] Type cast errors in version 9.2 while upgrade

2013-06-18 Thread Andreas Kretschmer
Arun P.L wrote: > Hi All, > > We are doing a postgresql upgrade from version 7.4.30 to 9.2. While testing > the > queries in newer version, the following error is obtained for some of the > queries which were working fine in older version. > > > "ERROR: operator does not exist: character var

Re: [GENERAL] Type cast errors in version 9.2 while upgrade

2013-06-18 Thread Alban Hertroys
On 18 June 2013 14:38, Arun P.L wrote: > > Hi All, > > We are doing a postgresql upgrade from version 7.4.30 to 9.2. While > testing the queries in newer version, the following error is obtained for > some of the queries which were working fine in older version. > > * > > "ERROR: operator does n

[GENERAL] Foreign Key constraint violation

2013-06-18 Thread Tim Kane
Hi all, I've discovered one of our databases has managed to get into a state where it is violating a foreign key constraint. The facts are these: Table B (row_id) references Table A (row_id). Table B contains multiple row_id's that do not exist in Table A. There also exists a BEFORE INSERT OR UP

[GENERAL] Type cast errors in version 9.2 while upgrade

2013-06-18 Thread Arun P . L
Hi All, We are doing a postgresql upgrade from version 7.4.30 to 9.2. While testing the queries in newer version, the following error is obtained for some of the queries which were working fine in older version. "ERROR: operator does not exist: character varying = integer.HINT: No operator

[GENERAL] I want to make an example of using parameterized path

2013-06-18 Thread 高健
Hello: I have some questions about parameterized path. I have heard that it is a new feature in PG9.2. I digged for information of parameterized path, but found few(maybe my method is not right). My FIRST question is: What is "parameterized path " for? Is the following a correct example

Re: [GENERAL] JDBC prepared statement is not treated as prepared statement

2013-06-18 Thread 高健
Hello : >Server prepared statements are kept in the private memory of the >PostgreSQL backend process. If you need a statement only once or >twice, it would be wasteful to keep it around. >The idea is that it is worth the effort only if the statement is executed >more than a couple of times.

[GENERAL] Migration from DB2 to PostgreSQL

2013-06-18 Thread sachin kotwal
Function in DB2: BLOB()Criteria:Size of character string targeted for cast is more than 1GBHow can I migrate this function into PostgreSQL with above mention criteria. -- View this message in context: http://postgresql.1045698.n5.nabble.com/Migration-from-DB2-to-PostgreSQL-tp5759607.html Sent f

Re: [GENERAL] CASE Statement - Order of expression processing

2013-06-18 Thread Albe Laurenz
Andrea Lombardoni wrote: > It gets even stranger: > > template1=# SELECT CASE WHEN (SELECT 0)=0 THEN 0 ELSE 1/(select 0) END; > case > -- > 0 > (1 row) > > Here it seems that the ELSE does not get evaluated (which is correct). Yes, of course, because both subselects will not get evaluat

Re: [GENERAL] JDBC prepared statement is not treated as prepared statement

2013-06-18 Thread Albe Laurenz
高健 wrote: > I change my Java program by adding the following: > > org.postgresql.PGStatement pgt = (org.postgresql.PGStatement)pst; > pgt.setPrepareThreshold(1); > > I can see an entry is in pg_prepared_statements now. Good. > But the hyperlink's documentation made me a little confused. I also

Re: [GENERAL] CASE Statement - Order of expression processing

2013-06-18 Thread Andrea Lombardoni
On Mon, Jun 17, 2013 at 11:11 PM, Stefan Drees wrote: > > pg924=# SELECT CASE WHEN 1 != 1 THEN 1/0 ELSE ((SELECT 1)=1)::integer END; > case > -- > 1 > (1 row) > > here the 1/0 is happily ignored. > It gets even stranger: template1=# SELECT CASE WHEN (SELECT 0)=0 THEN 0 ELSE 1/(select

Re: [GENERAL] CASE Statement - Order of expression processing

2013-06-18 Thread Albe Laurenz
Stefan Drees wrote: > On 2013-06-17 22:17 +02:00, Andrea Lombardoni wrote: >> I observed the following behaviour (I tested the following statements in >> 9.0.4, 9.0.5 and 9.3beta1): >> >> $ psql template1 >> template1=# SELECT CASE WHEN 0=0 THEN 0 ELSE 1/0 END; >> case >> -- >> 0 >> (1