Re: [GENERAL] Optimizing Queries Joining Several Views

2012-01-26 Thread Tom Lane
Jason Long writes: > In order to do some complex calculations I have joined several views. > Each view could join quite a few tables. > The user is allowed to filter the results with several multi-select > input fields and this is used in the query as where a.id in > (:listOfIds). > This works f

Re: [GENERAL] How to push predicate down

2012-01-26 Thread Tom Lane
I wrote: > Hmm. The code explicitly won't push conditions down through an EXCEPT: > * 3. If the subquery contains EXCEPT or EXCEPT ALL set ops we cannot push > * quals into it, because that could change the results. > I remember coming to the conclusion that this is safe for > UNION/INTERSECT bu

Re: [GENERAL] Preventing access temporarily.

2012-01-26 Thread Scott Marlowe
On Thu, Jan 26, 2012 at 3:58 PM, Scott Marlowe wrote: > On Thu, Jan 26, 2012 at 3:55 PM, Gauthier, Dave > wrote: >> I found something else on the web. >> >> update pg_database set datallowconn = false where datname = 'foo'; >> update pg_database set datallowconn = true where datname = 'foo'; >>

[GENERAL] Multi master use case?

2012-01-26 Thread Oliver Kohll
Hello, A client of ours has always had problems with slow internet connectivity - they are in a part of the country where that is a problem. There are a few hundred staff sharing a couple of asymmetric (ADSL) connections. One issue is with accessing their web-based Postgres app, which we host.

Re: [GENERAL] Don't Thread On Me (PostgreSQL related)

2012-01-26 Thread Chris Travers
On Thu, Jan 26, 2012 at 3:18 PM, Thomas Kellerer wrote: > Rodrigo E. De León Plicet wrote on 26.01.2012 22:52: > > Oracle claims it for releases going back to 7 >> > > Not true. > > Quote from the Oracle concepts manual: > > "Multiple-process Oracle (also called multiuser Oracle) uses several >

Re: [GENERAL] How to push predicate down

2012-01-26 Thread salah jubeh
I think in my case, It is safe to push the predicate down.  Can someone please, examine the behavior of other databases.If it behaves like postgres, I will assume there are some cases where it can lead to wrong result set.  I tried SQL server but my windows refuses it :-)   Regards   ___

Re: [GENERAL] Don't Thread On Me (PostgreSQL related)

2012-01-26 Thread Chris Travers
On Thu, Jan 26, 2012 at 3:02 PM, Merlin Moncure wrote: > On Thu, Jan 26, 2012 at 3:52 PM, Rodrigo E. De León Plicet > wrote: > > Quote: > > > > == > > > > This thread > > > > > http://postgresql.1045698.n5.nabble.com/Multithread

Re: [GENERAL] Don't Thread On Me (PostgreSQL related)

2012-01-26 Thread Thomas Kellerer
Rodrigo E. De León Plicet wrote on 26.01.2012 22:52: Oracle claims it for releases going back to 7 Not true. Quote from the Oracle concepts manual: "Multiple-process Oracle (also called multiuser Oracle) uses several processes to run different parts of the Oracle Database code and additional

Re: [GENERAL] Don't Thread On Me (PostgreSQL related)

2012-01-26 Thread Merlin Moncure
On Thu, Jan 26, 2012 at 3:52 PM, Rodrigo E. De León Plicet wrote: > Quote: > > == > > This thread > > http://postgresql.1045698.n5.nabble.com/Multithread-Query-Planner-td5143643.html > > was mentioned in a performance sub-group po

Re: [GENERAL] Preventing access temporarily.

2012-01-26 Thread Scott Marlowe
On Thu, Jan 26, 2012 at 3:55 PM, Gauthier, Dave wrote: > I found something else on the web. > > update pg_database set datallowconn = false where datname = 'foo'; > update pg_database set datallowconn = true where datname = 'foo'; > > Seems to have worked OK. > > Thanks for the pg_hab.conf suggest

Re: [GENERAL] Preventing access temporarily.

2012-01-26 Thread Gauthier, Dave
I found something else on the web. update pg_database set datallowconn = false where datname = 'foo'; update pg_database set datallowconn = true where datname = 'foo'; Seems to have worked OK. Thanks for the pg_hab.conf suggestion. I'll add that to my notes. -Original Message- Fro

Re: [GENERAL] Preventing access temporarily.

2012-01-26 Thread Scott Marlowe
On Thu, Jan 26, 2012 at 3:05 PM, Gauthier, Dave wrote: > PG V9.0.1 on Linux > > > > I want to temporarily prevent users from connecting to a DB, let the > existing connections finish, , re-enable connections. > > What's the best way to do that? Edit pg_hba.conf to reject all connections and reloa

[GENERAL] Don't Thread On Me (PostgreSQL related)

2012-01-26 Thread Rodrigo E . De León Plicet
Quote: == This thread http://postgresql.1045698.n5.nabble.com/Multithread-Query-Planner-td5143643.html was mentioned in a performance sub-group posting. Give it a read. Back? It means, so far as I can see, that PG is toast. It

[GENERAL] Preventing access temporarily.

2012-01-26 Thread Gauthier, Dave
PG V9.0.1 on Linux I want to temporarily prevent users from connecting to a DB, let the existing connections finish, , re-enable connections. What's the best way to do that? Thanks in Advance

Re: [GENERAL] Best way to create unique primary keys across schemas?

2012-01-26 Thread Chris Angelico
On Fri, Jan 27, 2012 at 4:56 AM, panam wrote: > Thanks, yeah, but the dummy tables are needed anyway in my case for those > entities that are shared among the tenants :) Ah! Then that's easy :) ChrisA -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your

Re: [GENERAL] Help needed creating a view

2012-01-26 Thread salah jubeh
Hello , if you need to construct view with the columns math, physics , I think what you need is crosstab function Regards From: David Johnston To: 'Sebastian Tennant' ; pgsql-general@postgresql.org Sent: Thursday, January 26, 2012 8:50 PM Subject: Re: [G

[GENERAL] Stange "duplicate key value violates unique constraint" after "delete" at ON UPDATE trigger

2012-01-26 Thread Dmitry Koterov
Hello. PostgreSQL 8.4. I am trying to create a trigger which removes "old" rows from the table just before inserting a new one. The table has an UNIQUE INDEX on a column, that's why I need to remove an old item with the same value of the column before inserting a new one. If I work without transa

Re: [GENERAL] Help needed creating a view

2012-01-26 Thread David Johnston
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Sebastian Tennant Sent: Thursday, January 26, 2012 6:55 AM To: pgsql-general@postgresql.org Subject: [GENERAL] Help needed creating a view Hi list, Given an 'applications'

[GENERAL] Help needed creating a view

2012-01-26 Thread Sebastian Tennant
Hi list, Given an 'applications' table for a static set of courses:: user_id (integer) course_name (text) completed (boolean) how best should I go about creating an 'alumni' view with columns: user_id (integer) maths (boolean) english (boolean) . . . . . . w

[GENERAL] Optimizing Queries Joining Several Views

2012-01-26 Thread Jason Long
In order to do some complex calculations I have joined several views. Each view could join quite a few tables. The user is allowed to filter the results with several multi-select input fields and this is used in the query as where a.id in (:listOfIds). This works fine if the user does not filter

Re: [GENERAL] Let-bindings in SQL statements

2012-01-26 Thread Filip Rembiałkowski
On Thu, Jan 26, 2012 at 3:37 PM, Jon Smark wrote: > Hi, > > Is it possible to do the equivalent of let-bindings in a pure SQL function? > I have a SELECT that invokes "now" multiple times. It would be nicer > to do it only once and reuse the value. Something like this: > > LET right_now = SELEC

Re: [GENERAL] Best way to create unique primary keys across schemas?

2012-01-26 Thread panam
Thanks, yeah, but the dummy tables are needed anyway in my case for those entities that are shared among the tenants :) -- View this message in context: http://postgresql.1045698.n5.nabble.com/Best-way-to-create-unique-primary-keys-across-schemas-tp5165043p5433562.html Sent from the PostgreSQL -

Re: [GENERAL] How to push predicate down

2012-01-26 Thread Tom Lane
salah jubeh writes: > Sorry,  The scenario, that I posted was not correct. I have traced it and the > union was not the problem, As I said the query excusion plan is over 5000 > line. I have created a scenario which similar to the scenario causes the > problem I have. > [ query uses EXCEPT no

Re: [GENERAL] Let-bindings in SQL statements

2012-01-26 Thread David W Noon
On Thu, 26 Jan 2012 06:37:49 -0800 (PST), Jon Smark wrote about [GENERAL] Let-bindings in SQL statements: >Is it possible to do the equivalent of let-bindings in a pure SQL >function? I have a SELECT that invokes "now" multiple times.  It would >be nicer to do it only once and reuse the value.  So

Re: [GENERAL] Composite Type : pros and cons

2012-01-26 Thread Merlin Moncure
On Thu, Jan 26, 2012 at 3:22 AM, Leguevaques Alex wrote: > > Hello, > I'm new to Pg and exploring its advanced functionalities for a project. > I find composite type very interesting, but what are problems/limitations ? > I'd want to create this structure for example: Composite types add a little

Re: [GENERAL] How to push predicate down

2012-01-26 Thread salah jubeh
Sorry,  The scenario, that I posted was not correct. I have traced it and the union was not the problem, As I said the query excusion plan is over 5000 line. I have created a scenario which similar to the scenario causes the problem I have. CREATE TABLE TEST ( ID SERIAL PRIMARY KEY, COL1 TEXT

Re: [GENERAL] Let-bindings in SQL statements

2012-01-26 Thread David Johnston
-Original Message- From: pgsql-general-ow...@postgresql.org [mailto:pgsql-general-ow...@postgresql.org] On Behalf Of Jon Smark Sent: Thursday, January 26, 2012 9:38 AM To: pgsql-general@postgresql.org Subject: [GENERAL] Let-bindings in SQL statements Hi, Is it possible to do the equivalen

Re: [GENERAL] How to push predicate down

2012-01-26 Thread Volodymyr Kostyrko
salah jubeh wrote: Hello Guys, In the past I had a view defined as follows CREATE view abcd as SELECT whatever .. --- query1 Some business requierments came up and I had to change it like this CREATE view abcd as SELECT whatever .. --- query1 UNION SELECT whatever .. query2

Re: [GENERAL] Let-bindings in SQL statements

2012-01-26 Thread Szymon Guz
On 26 January 2012 15:37, Jon Smark wrote: > Hi, > > Is it possible to do the equivalent of let-bindings in a pure SQL function? > I have a SELECT that invokes "now" multiple times. It would be nicer > to do it only once and reuse the value. Something like this: > > LET right_now = SELECT now (

[GENERAL] Let-bindings in SQL statements

2012-01-26 Thread Jon Smark
Hi, Is it possible to do the equivalent of let-bindings in a pure SQL function? I have a SELECT that invokes "now" multiple times.  It would be nicer to do it only once and reuse the value.  Something like this: LET right_now = SELECT now () IN SELECT * FROM my_table WHERE right_now >= start AND

[GENERAL] How to push predicate down

2012-01-26 Thread salah jubeh
Hello Guys, In the past  I had a view defined as follows CREATE view abcd as SELECT whatever .. --- query1 Some business requierments came up and I had to change it like this   CREATE view abcd as SELECT whatever .. --- query1 UNION SELECT whatever .. query2 Now I have

Re: [GENERAL] Best way to create unique primary keys across schemas?

2012-01-26 Thread Chris Angelico
On Thu, Jan 26, 2012 at 2:12 AM, panam wrote: > CREATE TABLE tbl (ID bigint default nextval('global_seq') primary key,foo > varchar,bar varchar);  --in public schema > CREATE TABLE schema1.tbl (LIKE public.tbl INCLUDING ALL);  --draws ids from > sequence in public schema > CREATE TABLE schema2.tbl

[GENERAL] Composite Type : pros and cons

2012-01-26 Thread Leguevaques Alex
Hello, I'm new to Pg and exploring its advanced functionalities for a project. I find composite type very interesting, but what are problems/limitations ? I'd want to create this structure for example: Phone Nom du champ Type Accès Clef Commentaire typ_tel integer type téléphone (liste 25) tel