Re: [GENERAL] ts_rank seems very slow (140 ranked documents / second on my machine)

2011-07-12 Thread Oleg Bartunov
On Tue, 12 Jul 2011, Nicolas Grilly wrote: On Tue, Jul 12, 2011 at 22:25, Oleg Bartunov wrote: I don't see your query uses index :) Yes, I know. :) I ran VACUUM ANALYZE and re-ran the query but the output of EXPLAIN ANALYZE stays exactly the same: no index used. Any idea why? there is pr

Re: [GENERAL] Alter Columns with Triggers

2011-07-12 Thread Sim Zacks
I don't recall any problems with functions or triggers, in my experience the problems are with the views. Any views that are on the table must be recreated. In any case, I wrote a function a while back that can be fairly easily modified to do what you want. My function is for modifying a vi

Re: [GENERAL] Weird problem that enormous locks

2011-07-12 Thread Tony Wang
On Wed, Jul 13, 2011 at 08:40, Craig Ringer wrote: > On 13/07/2011 12:52 AM, Tony Wang wrote: > >> Have any one experienced that, or any suggestion on researching/debugging? >> >> Capture the contents of pg_catalog.pg_stat_activity whenever your cron > job notices high lock counts. That'll give y

Re: [GENERAL] Weird problem that enormous locks

2011-07-12 Thread Craig Ringer
On 13/07/2011 12:52 AM, Tony Wang wrote: Have any one experienced that, or any suggestion on researching/debugging? Capture the contents of pg_catalog.pg_stat_activity whenever your cron job notices high lock counts. That'll give you some more information to work with. POST Newspapers 276 On

Re: [GENERAL] No suitable driver found for jdbc:postgresql [error]

2011-07-12 Thread Craig Ringer
On 9/07/2011 11:56 PM, Jonathan Camilleri wrote: In order to enable JDK to connect to the library files, I copied over /postgresql-8.4-702.jdbc*3*.jar/, and, /postgresql-8.4-702.jdbc*4*.jar/ to /C:\Program Files\Java\jre6\lib\ext/. Argh, don't do that! You're messing with *every* java program

Re: [GENERAL] Alter Columns with Triggers

2011-07-12 Thread Craig Ringer
On 12/07/2011 9:23 AM, Adrian Parker wrote: Is there a quick and easy fix? Currently I'm copying/pasting the drop/create statements from pgadmin (its very slow and error prone) and putting them in my python source. I don't know about "quick and easy", but you can get the trigger function source

Re: [GENERAL] Fw: Re: [BUGS] BUG #6099: Does pgcluster support hibernate?

2011-07-12 Thread Craig Ringer
On 11/07/2011 12:54 PM, 赵伟宇 wrote: 2011-07-1 Your message was empty except for a signature, this date, and forwarded message content. You seem to have forwarded a question you submitted using the bug report from the pgsql-bugs list to pgsql-general. Was that intentional? As I asked in my or

Re: [GENERAL] help for xml create in postgresql

2011-07-12 Thread Craig Ringer
On 11/07/2011 3:44 PM, Jignesh Ramavat wrote: *BUT IF i want result in following format then?* Use xmlagg and a subquery. -- Craig Ringer POST Newspapers 276 Onslow Rd, Shenton Park Ph: 08 9381 3088 Fax: 08 9388 2258 ABN: 50 008 917 717 http://www.postnewspapers.com.au/ -- Sent

Re: [GENERAL] Unexpected results with joins on dates

2011-07-12 Thread Tim Uckun
> Only the first SELECT is used to define column types and names (in the case > of NULL AS source2_* I am not positive if you need to cast the NULL or if it > will use the type found in the second SELECT) and I generally put a "source" > field into the output with a textual representation of whi

Re: [GENERAL] ts_rank seems very slow (140 ranked documents / second on my machine)

2011-07-12 Thread Nicolas Grilly
On Tue, Jul 12, 2011 at 22:25, Oleg Bartunov wrote: > I don't see your query uses index :) Yes, I know. :) I ran VACUUM ANALYZE and re-ran the query but the output of EXPLAIN ANALYZE stays exactly the same: no index used. Any idea why? By the way, does ts_rank is supposed to use a GIN index wh

Re: [GENERAL] ts_rank seems very slow (140 ranked documents / second on my machine)

2011-07-12 Thread Oleg Bartunov
I don't see your query uses index :) On Tue, 12 Jul 2011, Nicolas Grilly wrote: Hello, I'm testing PostgreSQL full-text search on a table containing 1.000.000 documents. Document average length is 5.700 chars. Performance is good and very similar to what I can get with Xapian if I don't use ts

[GENERAL] ts_rank seems very slow (140 ranked documents / second on my machine)

2011-07-12 Thread Nicolas Grilly
Hello, I'm testing PostgreSQL full-text search on a table containing 1.000.000 documents. Document average length is 5.700 chars. Performance is good and very similar to what I can get with Xapian if I don't use ts_rank. But response time collapses if I use ts_rank to select the 50 best matching d

Re: [GENERAL] Concurrent read from a partition table.

2011-07-12 Thread hyelluas
Hi Chetan, I'm not sure how I can create a test case, I'm running queryes on 50g of data to see this. My general questions are about locking children when select from a parent, I have not seen any documentation on it. Does any parameter like 'concurrent read' exist? I'm still new to postgres, c

[GENERAL] psql feature request

2011-07-12 Thread Wim Bertels
Hallo, psql feature request i would be nice if /o file_with_less.txt for redirecting output to a file could contain the same info as the logfile psql -a -L file_with_more.txt (and -eE if u need it) option -a echo's all, but this info doesn't get written to /o file_with_less.txt why? within on

Re: [GENERAL] Anyone using silent_mode?

2011-07-12 Thread Vick Khera
On Mon, Jun 27, 2011 at 3:06 AM, Heikki Linnakangas wrote: > Is anyone using silent_mode=on ? There's some discussion on pgsql-hackers > [1] on whether it should be removed altogether in 9.2, since you can get the > same functionality with "pg_ctl start", or nohup. If you're using > silent_mode, w

Re: [GENERAL] Unexpected results when joining on date fields

2011-07-12 Thread Alban Hertroys
On 11 Jul 2011, at 1:58, Tim Uckun wrote: > I have two tables, traffic and sales. Each one has a date field and > lists the traffic and sales broken down by various parameters > (multiple rows for each date). > > If I run select (select count(*) from traffic) as traffic, (select > count(*) from

[GENERAL] Weird problem that enormous locks

2011-07-12 Thread Tony Wang
Hi, The configuration information is listed at the end. I met this problem last weekend. The presentation was that, the db locks became enormous, up to 8.3k, and the db hanged there. About half an hour to one hour later, it recovered: the locks became 1 or 2 hundreds, which was its average level.

Re: [GENERAL] plpgsql function confusing behaviour

2011-07-12 Thread Merlin Moncure
On Mon, Jul 11, 2011 at 3:23 PM, Shianmiin wrote: > We have recently gone thru an unexpected behavior of PostgreSQL function > written in plpgsql. > I wonder if anyone can help explain the ideas behind the design. > > Test scenario: > 1. create two identical schemas, let's call them tenant1 and te

Re: [GENERAL] Schema for Website Comments

2011-07-12 Thread Vibhor Kumar
On Jul 12, 2011, at 7:54 PM, Prabhat Kumar wrote: > Today I need to create a schema for my application website that allows user > comments too. > I think we have to maintain hierarchical data and it is very common as all > sites are supporting this feature. > Can somebody suggest me some guidel

Re: [GENERAL] Marking a Column for Special Use

2011-07-12 Thread Terry Lee Tucker
On Tuesday, July 12, 2011 11:33:34 AM David Johnston wrote: > Can you make use of "COMMENT ON ."? > > > > From: pgsql-general-ow...@postgresql.org > [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Terry Lee Tucker > Sent: Tuesday, July 12, 2011 11:25 AM > To: pgsql-general@postgresql.or

Re: [GENERAL] Marking a Column for Special Use

2011-07-12 Thread Terry Lee Tucker
On Tuesday, July 12, 2011 11:47:33 AM Andrew Sullivan wrote: > On Tue, Jul 12, 2011 at 11:25:24AM -0400, Terry Lee Tucker wrote: > > Greetings: > > > > I have a scenario in which it would be quite convenient to mark about 20 > > existing columns in a table such that I can select those fields > > p

Re: [GENERAL] Marking a Column for Special Use

2011-07-12 Thread Andrew Sullivan
On Tue, Jul 12, 2011 at 11:25:24AM -0400, Terry Lee Tucker wrote: > Greetings: > > I have a scenario in which it would be quite convenient to mark about 20 > existing columns in a table such that I can select those fields > programatically, based on my flag, for some specialized processing. What

Re: [GENERAL] Marking a Column for Special Use

2011-07-12 Thread David Johnston
Can you make use of "COMMENT ON ."? From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Terry Lee Tucker Sent: Tuesday, July 12, 2011 11:25 AM To: pgsql-general@postgresql.org Subject: [GENERAL] Marking a Column for Special Use Greetings: I

[GENERAL] Marking a Column for Special Use

2011-07-12 Thread Terry Lee Tucker
Greetings: I have a scenario in which it would be quite convenient to mark about 20 existing columns in a table such that I can select those fields programatically, based on my flag, for some specialized processing. What I am trying to avoid is storing a list of columns somehere. Is there somet

Re: [GENERAL] Unexpected results when joining on date fields

2011-07-12 Thread Rick Genter
I don't think you understand what JOIN does. Think of it as a double-nested FOR loop: for each record that has the value on the left side of the JOIN, it will match all records on the right side of the JOIN that meet the ON criteria. For example, if I have two tables: A (i int, j int): i j

[GENERAL] Unexpected results when joining on date fields

2011-07-12 Thread Tim Uckun
I have two tables, traffic and sales. Each one has a date field and lists the traffic and sales broken down by various parameters (multiple rows for each date). If I run select (select count(*) from traffic) as traffic, (select count(*) from sales) as sales; I get the following 49383;167807 if

[GENERAL] Fw: Re: [BUGS] BUG #6099: Does pgcluster support hibernate?

2011-07-12 Thread 赵伟宇
2011-07-11 赵伟宇 北京英泰伟业通信技术开发有限公司 运行维护部 地址:北京市宣武区新居东里4号楼鼎元国际中心 (100055) Tel:010-63263322-8676Mobile:18701380311 Fax:010-63285517 E-mail:zha...@iwgroup.com.cn 本邮件可能含有机密内容,非指定收件人请勿打开、复印本邮件或依赖本邮件的内容而采取任何行动。若误收到本邮件,请立即通知发件人并删除本邮件及其附件。 This message may contain privileged and confidential in

[GENERAL] plpgsql function confusing behaviour

2011-07-12 Thread Shianmiin
We have recently gone thru an unexpected behavior of PostgreSQL function written in plpgsql. I wonder if anyone can help explain the ideas behind the design. Test scenario: 1. create two identical schemas, let's call them tenant1 and tenant2 -- set up tenant1 create schema tenant1; set search_pat

Re: [GENERAL] Schema for Website Comments

2011-07-12 Thread Prabhat Kumar
http://www.ferdychristant.com/blog//archive/DOMM-7QJPM7 On Sun, Jul 10, 2011 at 10:14 PM, Adarsh Sharma wrote: > Dear all, > > Today I need to create a schema for my application website that allows user > comments too. > > I think we have to maintain hierarchical data and it is very common as all

Re: [GENERAL] No suitable driver found for jdbc:postgresql [error]

2011-07-12 Thread Adrian Klaver
On Tuesday, July 12, 2011 6:07:28 am Jon80 wrote: > On Jul 9, 6:32 pm, rjgonz...@estrads.com.ar (Rodrigo Gonzalez) wrote: > > On 07/09/2011 12:56 PM, Jonathan Camilleri wrote:> /Notes for Windows > > users/ > > > > http://www.postgresql.org/docs/9.0/static/app-psql.html > > How does this link ans

[GENERAL] Re: PostgreSQL JDBC: bytea column getMetaData().getColumns().getIn("COLUMN_SIZE") ~ 2GB

2011-07-12 Thread Grace Batumbya
I did a bit of looking around in the jdbc driver and found this method in: org.postgresql.jdbc2.TypeInfoCache public int getPrecision(int oid, int typmod) { oid = convertArrayToBaseOid(oid); switch (oid) { ... case Oid.TEXT: case Oid.BYTEA:

Re: [GENERAL] Unexpected results with joins on dates

2011-07-12 Thread David Johnston
You would have to use a UNION or a Function. Either way, semantically common fields would want to share the same type so they could be output using the same column. If you have additional fields you want to output that are source specific you can do so and just output NULL from invalid sources

Re: [GENERAL] ? about Composite Keys + ON DELETE/UPDATE SET NULL

2011-07-12 Thread David Johnston
> Hi, > > Is there any way to effect behavior similar to the following: > > FOREIGN KEY (field1, field2) > REFERENCES table2 (field1, field2) > ON UPDATE CASCADE > ON DELETE (SET field2 = NULL) -- leaving field1 with whatever value is currently holds That's quite dependant on how the referenc

Re: [GENERAL] No suitable driver found for jdbc:postgresql [error]

2011-07-12 Thread Jon80
On Jul 9, 6:32 pm, rjgonz...@estrads.com.ar (Rodrigo Gonzalez) wrote: > On 07/09/2011 12:56 PM, Jonathan Camilleri wrote:> /Notes for Windows users/ > > http://www.postgresql.org/docs/9.0/static/app-psql.html How does this link answer my questions? -- Sent via pgsql-general mailing list (pgsql-g

[GENERAL] PostgreSQL JDBC: bytea column getMetaData().getColumns().getIn("COLUMN_SIZE") ~ 2GB

2011-07-12 Thread Grace Batumbya
Hi there, I am using postgresql-9.0-801.jdbc3, on postgresql 9.0.4. On a bytea column, getMetaData().getColumns().getIn("COLUMN_SIZE") returns 2147483647 yet from asking around on #postgresql on irc, the bytea has a limit just less than 1GB. Why then does jdbc return 2GB instead of 1GB? -- *Gra

Re: [GENERAL] Slow queries (high duration) and their log entries appearing out-of-order

2011-07-12 Thread Jonathan Barber
On 11 July 2011 17:19, Jonathan Barber wrote: > I'm trying to debug a jboss/hibernate application that uses PostgreSQL > as a backend, for which PostgreSQL is reporting a lot of queries as > taking around 4398046 ms (~73 minutes) plus or minus 10 ms to > complete. I have two questions about this.

[GENERAL] Alter Columns with Triggers

2011-07-12 Thread Adrian Parker
Hello. I'm quite new to Postgres. I've just been assigned the task of changing 300+ Double Precision columns, spread out over 30+ tables, to be of type Numeric(100, 3). Many of the columns have one or more triggers/functions on them. The alterations will run from a python program acting as a datab

[GENERAL] help for xml create in postgresql

2011-07-12 Thread Jignesh Ramavat
i need to create xml by using xml function in postgresql. i can create following xml by using this query Query: SELECT XMLELEMENT(name chapter, XMLATTRIBUTES( '1' AS number, CURRENT_DATE as current_date), XMLELEMENT(name document, XMLATTRIBUTES((select typeaccountcode from typeaccount limit 1) AS

Re: [GENERAL] Unexpected results with joins on dates

2011-07-12 Thread Tim Uckun
On Tue, Jul 12, 2011 at 3:01 PM, David Johnston wrote: > If traffic has 5 records on a date and sales has 4 on the same date you would > output 20 records for that date. What would I have to do in order to get 9 records instead of 20. Like a union but with dissimilar schema. -- Sent via pgsql

Re: [HACKERS] [GENERAL] Creating temp tables inside read only transactions

2011-07-12 Thread Alban Hertroys
On 12 Jul 2011, at 3:25, Chris Travers wrote: >> Right now I can emulate a hierarchical schema structure via a naming scheme >> - for example "schemabase_sub1_sub2_etc". I am simply looking for a formal >> way to do the above AND also tell the system that I want all schemas under >> "schemabase"

Re: [GENERAL] Unexpected results with joins on dates

2011-07-12 Thread Alban Hertroys
On 12 Jul 2011, at 4:53, Tim Uckun wrote: (Edited to take the irrelevant stuff out) > select count(traffic.date) from traffic inner join sales on traffic.date = > sales.date > running this query gives me this result > 25121853 > On the third select (two table join) it doesn't matter if I chang

Re: [GENERAL] ? about Composite Keys + ON DELETE/UPDATE SET NULL

2011-07-12 Thread Alban Hertroys
On 12 Jul 2011, at 1:02, David Johnston wrote: > Hi, > > Is there any way to effect behavior similar to the following: > > FOREIGN KEY (field1, field2) > REFERENCES table2 (field1, field2) > ON UPDATE CASCADE > ON DELETE (SET field2 = NULL) -- leaving field1 with whatever value is > currently

Re: [GENERAL] Concurrent read from a partition table.

2011-07-12 Thread Chetan Suttraway
On Tue, Jul 12, 2011 at 6:01 AM, hyelluas wrote: > Hello, > > I’m having a problem with concurrent processing. > 2 queries are accessing the same parent table that have 24 partitions. > I see “shared lock is not granted “ for one of them on one of the children > while the other query is running.

Re: [HACKERS] [GENERAL] Creating temp tables inside read only transactions

2011-07-12 Thread Florian Pflug
On Jul11, 2011, at 21:49 , David Johnston wrote: > Right now I can emulate a hierarchical schema structure via a naming scheme > - for example "schemabase_sub1_sub2_etc". I am simply looking for a formal > way to do the above AND also tell the system that I want all schemas under > "schemabase" t