Re: [GENERAL] Unexpected results with joins on dates

2011-07-11 Thread David Johnston
If traffic has 5 records on a date and sales has 4 on the same date you would output 20 records for that date. Instead of dealing with the entire table just pick out a couple of dates and show the results of the join in detail instead of just counts. David J. On Jul 11, 2011, at 22:53, Tim Uc

[GENERAL] Unexpected results with joins on dates

2011-07-11 Thread Tim Uckun
I have three tables. traffic, sales and dates. Both the traffic table and the sales table has multiple entries per date with each row representing the date, some subdivision, and the total. For example every day five divisions could be reporting their sales so there would be five entries in the sa

Re: [GENERAL] Accidentally truncated pg_type

2011-07-11 Thread Jeff Davis
On Tue, 2011-07-12 at 01:12 +0100, Matthew Byrne wrote: > I have a large database full of irreplaceable data, and due to a > ridiculous happenstance I accidentally executed this code (as a superuser, > of course): > > DELETE FROM pg_catalog.pg_type; > > Now the database is *seriously* unhappy - e

[GENERAL] query_to_xml nulls set to false

2011-07-11 Thread Lynn Dobbs
I am using query_to_xml with nulls set to false in postgresql 9.0.4. (I believe the behavior was also present in 8.4.) The documentation for query_to_xml says that if set to true, nulls with be treated with xsi:nil="true" and "An appropriate namespace declaration will be added to the result value

Re: [GENERAL] Accidentally truncated pg_type

2011-07-11 Thread Chris Travers
On Mon, Jul 11, 2011 at 6:25 PM, Craig Ringer wrote: > On 12/07/11 08:12, Matthew Byrne wrote: >> I have a large database full of irreplaceable data, and due to a >> ridiculous happenstance I accidentally executed this code (as a superuser, >> of course): >> >> DELETE FROM pg_catalog.pg_type; >> >

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

2011-07-11 Thread Chris Travers
On Mon, Jul 11, 2011 at 12:49 PM, David Johnston wrote: > I do not see how recursive queries (really iteration of records) even enters > the picture... I agree, FWIW. If the feature was that desirable, we could look at questions of implementation to make recursion either unnecessary or at least

Re: [GENERAL] Accidentally truncated pg_type

2011-07-11 Thread Craig Ringer
On 12/07/11 08:12, Matthew Byrne wrote: > I have a large database full of irreplaceable data, and due to a > ridiculous happenstance I accidentally executed this code (as a superuser, > of course): > > DELETE FROM pg_catalog.pg_type; > > Now the database is *seriously* unhappy - every SQL command

Re: [GENERAL] Accidentally truncated pg_type

2011-07-11 Thread Craig Ringer
On 12/07/11 08:12, Matthew Byrne wrote: > I have a large database full of irreplaceable data, and due to a > ridiculous happenstance I accidentally executed this code (as a superuser, > of course): > > DELETE FROM pg_catalog.pg_type; > > Now the database is *seriously* unhappy - every SQL command

Re: [GENERAL] Interesting article, Facebook woes using MySQL

2011-07-11 Thread Chris Travers
On Mon, Jul 11, 2011 at 12:50 PM, Gauthier, Dave wrote: > http://gigaom.com/cloud/facebook-trapped-in-mysql-fate-worse-than-death/ > > > > How would PG stack up in a usage situation like this? My sense is that Pg would stack up no better. I suspect to make this work at this scale you'd have to

[GENERAL] Concurrent read from a partition table.

2011-07-11 Thread hyelluas
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. Does the “ select from a parent table” make a lock on the

[GENERAL] Accidentally truncated pg_type

2011-07-11 Thread Matthew Byrne
I have a large database full of irreplaceable data, and due to a ridiculous happenstance I accidentally executed this code (as a superuser, of course): DELETE FROM pg_catalog.pg_type; Now the database is *seriously* unhappy - every SQL command returns an error message. How do I get at my data?

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

2011-07-11 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 With MATCH SIMPLE the NULL in field2 is sufficien

Re: [GENERAL] Interesting article, Facebook woes using MySQL

2011-07-11 Thread Andrew Sullivan
On Mon, Jul 11, 2011 at 03:53:20PM -0500, Merlin Moncure wrote: > example, it's not clear why 1,800 servers running mysql is necessarily > a 'fate worse than death'. Speaking personally, I find even one server running mysql (if it's my responsibility) is pretty enervating. I can imagine 1,800 co

Re: [GENERAL] Interesting article, Facebook woes using MySQL

2011-07-11 Thread Merlin Moncure
On Mon, Jul 11, 2011 at 2:50 PM, Gauthier, Dave wrote: > http://gigaom.com/cloud/facebook-trapped-in-mysql-fate-worse-than-death/ Well, Stonebraker is pitching (for the Nth time) a "revolutionary" platform, VoltDB, which naturally brings up concerns about bias. For example, it's not clear why 1,8

Re: [GENERAL] Interesting article, Facebook woes using MySQL

2011-07-11 Thread Tomas Vondra
Dne 11.7.2011 21:50, Gauthier, Dave napsal(a): > http://gigaom.com/cloud/facebook-trapped-in-mysql-fate-worse-than-death/ > > How would PG stack up in a usage situation like this? This article (and the slashdot discussion) was already mentioned in the pg-advocacy list http://archives.postgresq

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

2011-07-11 Thread Darren Duncan
I will put my support for David Johnston's proposal, in principle, though minor details of syntax could be changed if using "!" conflicts with something. -- Darren Duncan David Johnston wrote: On Mon, Jul 11, 2011 at 10:12 AM, Florian Pflug wrote: On Jul11, 2011, at 07:08 , Darren Duncan wro

Re: [GENERAL] sql or pgsql question, accessing a created value

2011-07-11 Thread Raymond O'Donnell
On 11/07/2011 20:19, David Salisbury wrote: Hope someone's out there for this one. Basically I'm creating a summary table of many underlying tables in one select statement ( though that may have to change ). My problem can be shown in this example.. select my_function( timeofmeasurement, longit

Re: [GENERAL] sql or pgsql question, accessing a created value

2011-07-11 Thread David Johnston
select my_function( timeofmeasurement, longitude ) as solarnoon, extract(epoch from ( timeofmeasurement - solarnoon ) as solardiff ( case when solardiff < 3600 then 'Y' else 'N' end ) as within_solar_hour from my_table; But I get an error along the lines of ERROR: column "sol

[GENERAL] Interesting article, Facebook woes using MySQL

2011-07-11 Thread Gauthier, Dave
http://gigaom.com/cloud/facebook-trapped-in-mysql-fate-worse-than-death/ How would PG stack up in a usage situation like this?

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

2011-07-11 Thread David Johnston
On Mon, Jul 11, 2011 at 10:12 AM, Florian Pflug wrote: > On Jul11, 2011, at 07:08 , Darren Duncan wrote: >> Christopher Browne wrote: >>> Vis-a-vis the attempt to do nested naming, that is "ns1.ns2.table1", >>> there's a pretty good reason NOT to support that, namely that this >>> breaks relatio

[GENERAL] sql or pgsql question, accessing a created value

2011-07-11 Thread David Salisbury
Hope someone's out there for this one. Basically I'm creating a summary table of many underlying tables in one select statement ( though that may have to change ). My problem can be shown in this example.. select my_function( timeofmeasurement, longitude ) as solarnoon, extract(epoch

Re: [GENERAL] Performance Monitoring of PostGRE

2011-07-11 Thread Vincent de Phily
On Wednesday 06 July 2011 14:27:53 BangarRaju Vadapalli wrote: >We want to monitor the performance of PostGRE database. Could anyone > please suggest any tools tried/working successfully... Munin will graph some usefull postgres stats. It's easy enough to graph another datapoint by creating a

Re: [GENERAL] Schema for Website Comments

2011-07-11 Thread Chris Travers
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 > sites are supporting this feature. > > Can somebody su

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

2011-07-11 Thread Jonathan Barber
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. First, when I look at the logs, the long queries appea

[GENERAL] Two PHP projects looking for PostgreSQL help

2011-07-11 Thread Josh Berkus
Folks, In the last couple of weeks I've been approached by two PHP projects who could use help improving/maintainig their PostgreSQL support. One is Mediawiki, which just needs help with maintenance, testing, and improving certain features like full text search. The second is Joomla, which is in

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

2011-07-11 Thread Christopher Browne
On Mon, Jul 11, 2011 at 10:12 AM, Florian Pflug wrote: > On Jul11, 2011, at 07:08 , Darren Duncan wrote: >> Christopher Browne wrote: >>> Vis-a-vis the attempt to do nested naming, that is "ns1.ns2.table1", >>> there's a pretty good reason NOT to support that, namely that this >>> breaks relationa

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

2011-07-11 Thread Florian Pflug
On Jul11, 2011, at 07:08 , Darren Duncan wrote: > Christopher Browne wrote: >> Vis-a-vis the attempt to do nested naming, that is "ns1.ns2.table1", >> there's a pretty good reason NOT to support that, namely that this >> breaks relational handling of tables. PostgreSQL is a *relational* >> databas

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

2011-07-11 Thread David Johnston
Christopher Browne wrote: > Vis-a-vis the attempt to do nested naming, that is "ns1.ns2.table1", > there's a pretty good reason NOT to support that, namely that this > breaks relational handling of tables. PostgreSQL is a *relational* > database system, hence it's preferable for structures to b

[GENERAL] Schema for Website Comments

2011-07-11 Thread Adarsh Sharma
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 sites are supporting this feature. Can somebody suggest me some guidelines to follow and some links too. Thanks -

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

2011-07-11 Thread Florian Pflug
On Jul8, 2011, at 08:21 , Darren Duncan wrote: > Also, the proper way to do temporary tables would be to put them in > another database than the main one, where the whole other database > has the property of being temporary. FWIW, Microsoft SQL Server does it that way, and as a result temporary ta

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

2011-07-11 Thread Darren Duncan
Christopher Browne wrote: Vis-a-vis the attempt to do nested naming, that is "ns1.ns2.table1", there's a pretty good reason NOT to support that, namely that this breaks relational handling of tables. PostgreSQL is a *relational* database system, hence it's preferable for structures to be relatio