Re: [GENERAL] Weird disk/table space consumption problem

2009-07-12 Thread Scott Marlowe
On Sat, Jul 11, 2009 at 7:19 PM, Dirk Riehle wrote: > Tom Lane wrote: >> >> Dirk Riehle writes: >>> During boot, fsck (must have been fsck) gave me tons of freeing up inode >>> messages. >> >> And this part is a filesystem bug; it cannot possibly be Postgres' >> fault that the filesystem got corr

Re: [GENERAL] Weird disk/table space consumption problem

2009-07-12 Thread Scott Marlowe
On Sat, Jul 11, 2009 at 7:19 PM, Dirk Riehle wrote: > > I do have some weird every few days error where the soft raid blocks for a > couple of seconds and I get this kernel log output: > > Jul  7 19:58:55 server kernel: [40336.000239] ata1.00: status: { DRDY } > Jul  7 19:58:55 server kernel: [4033

Re: [GENERAL] indexes on float8 vs integer

2009-07-12 Thread Scott Marlowe
On Sat, Jul 11, 2009 at 10:15 PM, Dennis Gearon wrote: > > Anyone got any insight or experience in the speed and size of indexes on > Integer(4 byte) vs float (8byte). For a project that I'm on, I'm > contemplating using an integer for: > >     Latitude >     Longitude > > In a huge, publically s

Re: [GENERAL] INSERT only unique records

2009-07-12 Thread Craig Ringer
On Fri, 2009-07-10 at 13:32 -0700, Mark Felegyhazi wrote: > 1. put a unique constraint on num in to_t > -> problem: the first violation breaks the subquery and the remaining records > are never inserted - I don't know how to catch the error in subqueries > > 2. create the following insert rule:

Re: [GENERAL] Weird disk/table space consumption problem

2009-07-12 Thread Craig Ringer
On Sat, 2009-07-11 at 18:19 -0700, Dirk Riehle wrote: > I do have some weird every few days error where the soft raid blocks for > a couple of seconds and I get this kernel log output: > > Jul 7 19:58:55 server kernel: [40336.000239] ata1.00: status: { DRDY } > Jul 7 19:58:55 server kernel: [4

[GENERAL] xpath() subquery for empty array

2009-07-12 Thread Roy Walter
In postgres 8.4 When running xpath() queries it seems that empty results are always returned. So if I query a table containing 1000 XML documents a 1000 rows will always be fetched even if the xpath() element of the query only matches 10 documents. The documentation states: The function |x

[GENERAL] Best practices for moving UTF8 databases

2009-07-12 Thread Phoenix Kiula
Hi. I *always* get an error moving my current fully utf-8 database data into a new DB. My server has the version 8.3 with a five year old DB. Everything, all collation, LC_LOCALE etc are all utf8. When I install a new Postgresql 8.4 on my home Mac OSX machine (after losing some hair) I set everyt

Re: [GENERAL] INSERT only unique records

2009-07-12 Thread Sam Mason
On Fri, Jul 10, 2009 at 01:32:40PM -0700, Mark Felegyhazi wrote: > I'm learning Postgresql and trying to inserts only new entries in a > table and skips duplicates. I know this is a recurrent question, but > maybe you could point out what I'm doing wrong in this specific case. > To avoid duplicate

[GENERAL] Execute Immediate

2009-07-12 Thread Michael Gould
In many SQL dialets there is the availability of Execute immediate which allows you to build global temp tables or views at run time and even stored procedures at runtime and then execute them inline.  Is there a way to do this in PostGres 8.4   Best Regards   -- Michael Gould, Managing Par

Re: [GENERAL] Execute Immediate

2009-07-12 Thread Pavel Stehule
Hello plpgsql has execute statement, that has similar behave like execute immediate in others systems. note - postgresql doesn't support global temp tables yet. regards Pavel Stehule 2009/7/12 Michael Gould : > In many SQL dialets there is the availability of Execute immediate which > allows yo

[GENERAL] Re: [BUGS] BUG #4916: wish: more statistical functions (median, percentiles etc)

2009-07-12 Thread David Fetter
On Fri, Jul 10, 2009 at 11:37:46PM +, Richard Neill wrote: > > The following bug has been logged online: > > Bug reference: 4916 > Logged by: Richard Neill > Email address: rn...@cam.ac.uk > PostgreSQL version: 8.4 > Operating system: Linux > Description:wish: mor

Re: [GENERAL] xpath() subquery for empty array

2009-07-12 Thread Scott Bailey
Roy Walter wrote: In postgres 8.4 When running xpath() queries it seems that empty results are always returned. So if I query a table containing 1000 XML documents a 1000 rows will always be fetched even if the xpath() element of the query only matches 10 documents. The documentation states:

Re: [GENERAL] Checkpoint Tuning Question

2009-07-12 Thread Simon Riggs
On Fri, 2009-07-10 at 14:25 -0500, Dan Armbrust wrote: > > Hm, I'm not sure I believe any of that except the last bit, seeing that > > he's got plenty of excess CPU capability. But the last bit fits with > > the wimpy-I/O problem, and it also offers something we could test. > > Dan, please see wh

Re: [GENERAL] Execute Immediate

2009-07-12 Thread Michael Gould
Thanks, that is exactly what I need as a workaround to session variables. The temp tables will work as we need them as we only have a 5 that are temp tables and preserve is needed only for the active session, once the session has ended the temp table should go away. "Pavel Stehule" wrote: > 200

[GENERAL] Postgresql databases as a web service

2009-07-12 Thread dkeeney
Rdbhost.com offers SQL databases as a web service, running Postgresql 8.3.3 . Create a database on our server, execute queries against it in SQL via http request, and receive results as XML or JSON. There is a python DB API module for it as well. The service is demand priced (you pay for actual

Re: [GENERAL] Checkpoint Tuning Question

2009-07-12 Thread Tom Lane
Simon Riggs writes: > This causes us to queue for the WALInsertLock twice at exactly the time > when every caller needs to calculate the CRC for complete blocks. So we > queue twice when the lock-hold-time is consistently high, causing queue > lengths to go ballistic. You keep saying that, and it

Re: [GENERAL] xpath() subquery for empty array

2009-07-12 Thread Roy Walter
Scott Bailey wrote: Roy Walter wrote: In postgres 8.4 When running xpath() queries it seems that empty results are always returned. So if I query a table containing 1000 XML documents a 1000 rows will always be fetched even if the xpath() element of the query only matches 10 documents. The d

Re: [GENERAL] xpath() subquery for empty array

2009-07-12 Thread Sam Mason
On Sun, Jul 12, 2009 at 06:41:57PM +0100, Roy Walter wrote: > Scott Bailey wrote: > >Roy Walter wrote: > >>How do I test for an empty array in postgres? > > > >WHERE x != array[]::xml[] > > > > > Thanks Scott but that throws up a syntax error (at the closing bracket > of array[]): > >ERROR:

Re: [GENERAL] Checkpoint Tuning Question

2009-07-12 Thread Simon Riggs
On Sun, 2009-07-12 at 13:10 -0400, Tom Lane wrote: > It's hard to see how it could have continuing effects over several > seconds, especially in a system that has CPU to spare. Any queueing situation takes a while to resolve and over-damped systems can take a long time to resolve themselves. We

[GENERAL] Rule acting as REPLACE INTO behave strange

2009-07-12 Thread IVO GELOV
Hi. I am using version 8.3.7 on Fedora Core 4. I have a rule which mimics REPLACE INTO. The table is defined like this CREATE TABLE "balans"."bal_price" ( "acc_id" INTEGER NOT NULL, "debit" BIGINT NOT NULL, "credit" BIGINT NOT NULL, "pero_1" INTEGER, "pero_2" INTEGER, "pero_3" IN

[GENERAL] How can I find out the space used on disk for a table/index

2009-07-12 Thread Viktor Rosenfeld
Hi, I want to judge the performance gain of additional indexes against the space they consume on disk. Currently I do a VACUUM FULL ANALYZE and then take the space used by the base directory and do some calculations. This is time consuming, error-prone and unreliable. Is there a quick w

[GENERAL] Could not Start Server (could not create any TCP/IP sockets)

2009-07-12 Thread Ms swati chande
Hi, I built and installed Postgresql 8.4.0 from source using Visual Studio 2005 on Windows XP. All build and installation steps executed successfully as mentioned in the Postgresql Documentation, but server could not be started. Given below is the detail of the problem I am facing. >From user P

Re: [GENERAL] Postgresql databases as a web service

2009-07-12 Thread Scott Marlowe
On Sun, Jul 12, 2009 at 9:20 AM, dkeeney wrote: > > Rdbhost.com offers SQL databases as a web service, running Postgresql > 8.3.3 . > > Create a database on our server, execute queries against it in SQL via > http request, and receive results as XML or JSON.  There is a python > DB API module for i

Re: [GENERAL] How can I find out the space used on disk for a table/index

2009-07-12 Thread Andres Freund
On Sunday 12 July 2009 21:07:56 Viktor Rosenfeld wrote: > Hi, > > I want to judge the performance gain of additional indexes against the > space they consume on disk. Currently I do a VACUUM FULL ANALYZE and > then take the space used by the base directory and do some > calculations. This is time

Re: [GENERAL] Postgresql databases as a web service

2009-07-12 Thread Scott Bailey
Scott Marlowe wrote: On Sun, Jul 12, 2009 at 9:20 AM, dkeeney wrote: Rdbhost.com offers SQL databases as a web service, running Postgresql 8.3.3 . Create a database on our server, execute queries against it in SQL via http request, and receive results as XML or JSON. There is a python DB API m

Re: [GENERAL] xpath() subquery for empty array

2009-07-12 Thread Scott Bailey
Sam Mason wrote: On Sun, Jul 12, 2009 at 06:41:57PM +0100, Roy Walter wrote: Scott Bailey wrote: Roy Walter wrote: How do I test for an empty array in postgres? WHERE x != array[]::xml[] Thanks Scott but that throws up a syntax error (at the closing bracket of array[]): ERROR: synta

Re: [GENERAL] xpath() subquery for empty array

2009-07-12 Thread Roy Walter
Scott Bailey wrote: Sam Mason wrote: On Sun, Jul 12, 2009 at 06:41:57PM +0100, Roy Walter wrote: Scott Bailey wrote: Roy Walter wrote: How do I test for an empty array in postgres? WHERE x != array[]::xml[] Thanks Scott but that throws up a syntax error (at the closing bracket of array[]

Re: [GENERAL] indexes on float8 vs integer

2009-07-12 Thread Brent Wood
Hi Dennis, Is there any reason you are not using PostGIS to store the values as point geometries & use a spatial (GIST) index on them? I have tables with hundreds of millions of point features which work well. On disk data volume is not really worth optimising for with such systems, i suggest f

Re: [GENERAL] xpath() subquery for empty array

2009-07-12 Thread Sam Mason
On Sun, Jul 12, 2009 at 09:49:15PM +0100, Roy Walter wrote: > Where exactly does that fit in terms of my original query, i.e.: > >SELECT x >FROM (SELECT xpath('//entry[contains(p, ''searchtext'')]/@*', docxml) >AS x FROM docs) AS y WHERE x <> [test for empty array?] Something

Re: [GENERAL] xpath() subquery for empty array

2009-07-12 Thread Roy Walter
Sam Mason wrote: On Sun, Jul 12, 2009 at 09:49:15PM +0100, Roy Walter wrote: Where exactly does that fit in terms of my original query, i.e.: SELECT x FROM (SELECT xpath('//entry[contains(p, ''searchtext'')]/@*', docxml) AS x FROM docs) AS y WHERE x <> [test for empty array?

Re: [GENERAL] indexes on float8 vs integer

2009-07-12 Thread Dennis Gearon
Well, Brent, I'm just getting started on this design. I'm doing it at a hosting site, initially, so I have to find out if they have or will load this module. At first, I was just going to interpolate the distance as a bounding box based on the distance between latitude lines and longit

Re: [GENERAL] Rule acting as REPLACE INTO behave strange

2009-07-12 Thread Tom Lane
"IVO GELOV" writes: > I have a rule which mimics REPLACE INTO. The table is defined like this People keep thinking they can use rules for that :-( You can't do this. The problem in your case is that the INSERT happens, and then the rule fires and finds the inserted row, which it happily updates

Re: [GENERAL] How can I find out the space used on disk for a table/index

2009-07-12 Thread Greg Stark
On Sun, Jul 12, 2009 at 8:45 PM, Andres Freund wrote: > On Sunday 12 July 2009 21:07:56 Viktor Rosenfeld wrote: >> Hi, >> >> I want to judge the performance gain of additional indexes against the >> space they consume on disk.  Currently I do a VACUUM FULL ANALYZE and >> then take the space used by

[GENERAL] how drop a role that owns stuff ?

2009-07-12 Thread Andreas
Hi, for some cleaning up I'd like to drop a certain role. Now DROP ROLE yields an error and complains about 271 objects being owned by this role. Is there an easy way to switch ownership of those objects to another role? At least, is there a way to store those dependencies as a file? The conte

Re: [GENERAL] how drop a role that owns stuff ?

2009-07-12 Thread Alvaro Herrera
Andreas wrote: > Hi, > for some cleaning up I'd like to drop a certain role. > Now DROP ROLE yields an error and complains about 271 objects being > owned by this role. > > Is there an easy way to switch ownership of those objects to another role? Yes, see REASSIGN OWNED (gives ownership to some

[GENERAL] Design question: Should "postgres" own all the db objects?

2009-07-12 Thread Andreas
Hi, who should own the db objects? I once read one should not let postgres or any other superuser own the tables and what not. Instead one should better create a separate user role with little privileges to be the owner. I'm not quite sure why this was abvised. Maybe like not using root for ev

Re: [GENERAL] How move a referenced table between schemas?

2009-07-12 Thread Tom Lane
Andreas writes: > how can I move a table from one schema to another even though it is > referenced by foreign keys? ALTER TABLE SET SCHEMA. The foreign keys don't care (at least not in any remotely modern PG release). regards, tom lane -- Sent via pgsql-general mailing

[GENERAL] How move a referenced table between schemas?

2009-07-12 Thread Andreas
Hi, how can I move a table from one schema to another even though it is referenced by foreign keys? Cloning the table and the manually recreating every reference shouldn't be the only way, or is it? :( How can I dump/export every reference on a table? Until now I call DROP TABLE and look in the

Re: [GENERAL] indexes on float8 vs integer

2009-07-12 Thread Dennis Gearon
I wish that I didn't have to say this, but that is over my head at this point. I see this HUGE, steep mountain ahead of me and a little sign in front of it saying, "Learning Curve, start here." :-) Dennis Gearon Signature Warning EARTH has a Right To Life I agree with Bolivi

[GENERAL] Start With... Connect By?

2009-07-12 Thread Philippe Lang
Hi, Now that Postgresql 8.4 has a "WITH RECURSIVE" operator (thanks! :)), is there a chance we can see one day "START WITH... CONNECT BY" in Postgresql, or is that something 100% oracle-specific? Best regards, Philippe Lang -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org)

Re: [GENERAL] Start With... Connect By?

2009-07-12 Thread Thomas Kellerer
Philippe Lang, 13.07.2009 08:05: Hi, Now that Postgresql 8.4 has a "WITH RECURSIVE" operator (thanks! :)), is there a chance we can see one day "START WITH... CONNECT BY" in Postgresql, or is that something 100% oracle-specific? START WITH is Oracle specific whereas recursive CTEs are an ANSI