Re: [SQL] Ltree usage..

2002-08-02 Thread Rajesh Kumar Mallah.
Hi Oleg, It does not yeild the correct result for me. I am providing more details this time. path is ltree [] for me not ltree, Column | Type |Modifiers ++--

Re: [SQL] [NOVICE] Aggregates and Indexes

2002-08-02 Thread Bruce Momjian
Josh Berkus wrote: > > Adam, > > > I do a lot of reporting based on such SQL statements. Counting rows from > > large datasets. Since the PG gurus don't seem to think this is such a big > > deal can someone enlighten me as to why? > > I am not a core developer, but I will take a crack at your

Re: [SQL] What about this?

2002-08-02 Thread Tom Lane
Josh Berkus <[EMAIL PROTECTED]> writes: >> Why can't postmaster run VACUUM ANALYZE automatically every once in a >> while? Since it is a very useful feature... > Because such a practice is not appropriate for everyone's database > installation, that's why. No, the correct answer is "read the TO

Re: [SQL] Add Primary Key to a Table

2002-08-02 Thread Tom Haddon
Hi Josh, I think that solves it for me - I'm using 7.1.3 - will upgrade appropriately. Thanks, Tom -Original Message- From: Josh Berkus [mailto:[EMAIL PROTECTED]] Sent: Friday, August 02, 2002 4:20 PM To: Tom Haddon; [EMAIL PROTECTED] Subject: Re: [SQL] Add Primary Key to a Table Tom

Re: [SQL] Add Primary Key to a Table

2002-08-02 Thread Josh Berkus
Tom, > ALTER TABLE "agency_contact_info" ADD CONSTRAINT "agency_contact_info_pkey" > PRIMARY KEY ("id"); > > I get a message saying "ALTER TABLE / ADD CONSTRAINT not implemented for > that constraint type". Is this a bug, or am I doing something wrong? What version are you using? That command

[SQL] Add Primary Key to a Table

2002-08-02 Thread Tom Haddon
Hi Folks, I'm trying to use the ALTER TABLE command to add a primary key to a table. The command I am using is: ALTER TABLE "agency_contact_info" ADD CONSTRAINT "agency_contact_info_pkey" PRIMARY KEY ("id"); I get a message saying "ALTER TABLE / ADD CONSTRAINT not implemented for that constrai

Re: [SQL] What about this?

2002-08-02 Thread Josh Berkus
Wei, > Why can't postmaster run VACUUM ANALYZE automatically every once in a > while? Since it is a very useful feature... Because such a practice is not appropriate for everyone's database installation, that's why. -- -Josh Berkus Aglio Database Solutions San Francisco --

[SQL] What about this?

2002-08-02 Thread Wei Weng
Why can't postmaster run VACUUM ANALYZE automatically every once in a while? Since it is a very useful feature... -- Wei Weng Network Software Engineer KenCast Inc. ---(end of broadcast)--- TIP 5: Have you checked our extensive FAQ? http://www

Re: [SQL] [NOVICE] Aggregates and Indexes

2002-08-02 Thread Tom Lane
Josh Berkus <[EMAIL PROTECTED]> writes: > For Postgres custom aggregates, using a standard index is impossible, for > reasons I think are obvious. > That leaves MAX, MIN, and COUNT.All of these aggregates should, in an > ideal world, be index-responsive for large data sets. While it's fair

Re: [SQL] [NOVICE] Aggregates and Indexes

2002-08-02 Thread Josh Berkus
Adam, > I do a lot of reporting based on such SQL statements. Counting rows from > large datasets. Since the PG gurus don't seem to think this is such a big > deal can someone enlighten me as to why? I am not a core developer, but I will take a crack at your question anyway based on my perso

Re: [SQL] Seeking advice regarding a design problem

2002-08-02 Thread Stephan Szabo
On 2 Aug 2002, Wei Weng wrote: > On Fri, 2002-08-02 at 14:24, Stephan Szabo wrote: > > On 2 Aug 2002, Wei Weng wrote: > > > > > I am running postgresql as database backend, and I have some scripts > > > dealing with constant incoming data and then insert these data into the > > > database, in a q

Re: [SQL] Seeking advice regarding a design problem

2002-08-02 Thread Wei Weng
On Fri, 2002-08-02 at 14:24, Stephan Szabo wrote: > On 2 Aug 2002, Wei Weng wrote: > > > I am running postgresql as database backend, and I have some scripts > > dealing with constant incoming data and then insert these data into the > > database, in a quite complex way, involving a couple of pro

Re: [SQL] Seeking advice regarding a design problem

2002-08-02 Thread Stephan Szabo
On 2 Aug 2002, Wei Weng wrote: > I am running postgresql as database backend, and I have some scripts > dealing with constant incoming data and then insert these data into the > database, in a quite complex way, involving a couple of procedures. > > But the performance of the database is worse th

Re: [SQL] Ltree usage..

2002-08-02 Thread Oleg Bartunov
On Fri, 2 Aug 2002, Rajesh Kumar Mallah. wrote: > > Hi Oleg, > > I am trying to use contrib/ltree for one of my applications. > > the query below works fine for me. > > Qry1: SELECT path from unified_data where path ~ '*.180.*' and path ~ '*.1.*'; > > is there any way of compacting it for e

[SQL] Ltree usage..

2002-08-02 Thread Rajesh Kumar Mallah.
Hi Oleg, I am trying to use contrib/ltree for one of my applications. the query below works fine for me. Qry1: SELECT path from unified_data where path ~ '*.180.*' and path ~ '*.1.*'; is there any way of compacting it for example Qry2: SELECT path from unified_data where path ~ '*

Re: [SQL] Seeking advice regarding a design problem

2002-08-02 Thread Wei Weng
Forgot to mention, the version of postgresql I am running is 7.1.3. On Fri, 2002-08-02 at 12:16, Wei Weng wrote: > I am running postgresql as database backend, and I have some scripts > dealing with constant incoming data and then insert these data into the > database, in a quite complex way, inv

[SQL] Seeking advice regarding a design problem

2002-08-02 Thread Wei Weng
I am running postgresql as database backend, and I have some scripts dealing with constant incoming data and then insert these data into the database, in a quite complex way, involving a couple of procedures. But the performance of the database is worse than I had thought. After about 100 times o

[SQL] possible bug in \df+

2002-08-02 Thread Rajesh Kumar Mallah.
Hi there , " SELECT prosrc from pg_proc where proname=''; " and \df+ are reporting two different versions for FUNCTION body. eg: \df+ category_path shows: DECLARE v_category_id ALIAS FOR $1; DECLARE tmp_record RECORD; DECLARE tmp_id VARCHAR; DECLARE tmp_code VARCHAR; BEGIN t

Re: [SQL] Random resultset retrieving -> performance bottleneck

2002-08-02 Thread Stephan Szabo
On Thu, 1 Aug 2002, [iso-8859-1] Cédric Dufour wrote: > * > * 2. > * > BEGIN; > SET CONSTRAINTS ALL DEFERRED; > CREATE TEMP TABLE tmp_Large AS SELECT * FROM tb_Table; > DELETE FROM tb_Large; -- won't work; RI violation on foreign key > 'tb_Foo(FK_Large)' > INSERT INTO tb_Large SELECT * F

Re: [SQL] How to optimize SQL query ?

2002-08-02 Thread Cédric Dufour (Cogito Ergo Soft)
You're right ! Its always a question of keeping the cartesian products of joints as low as possible, depending on what you know of your data structure and on the WHERE clause(s) that you know might be most used on your query... Note that if you do not explicitely give the order of joints to Postg

Re: [SQL] How to optimize SQL query ?

2002-08-02 Thread Tom Lane
Milosz Krajewski <[EMAIL PROTECTED]> writes: > Can I force postgre do it my way ? Possibly. See http://www.ca.postgresql.org/users-lounge/docs/7.2/postgres/explicit-joins.html regards, tom lane ---(end of broadcast)--- TIP

Re: [SQL] Group And Sort After Union

2002-08-02 Thread Tom Lane
[EMAIL PROTECTED] (cnliou) writes: > I want to GROUP BY and ORDER BY on the result of UNION similar to the > following (wrong) SQL: > (SELECT c11 AS c1,SUM(c12) AS c2 FROM table1 > UNION > SELECT c21 AS c1,SUM(c22) AS c2 FROM table2 > ) > GROUP BY c1 > ORDER BY c2; Correct is SELECT * FROM (SEL

Re: [SQL] How to optimize SQL query ?

2002-08-02 Thread Cédric Dufour (Cogito Ergo Soft)
> -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of Milosz Krajewski > Sent: Monday, July 29, 2002 16:50 > To: [EMAIL PROTECTED] > Subject: [SQL] How to optimize SQL query ? > > > How to optimize query or just force postgre to do it my way ? > > Example:

Re: [SQL] Returning PK of first insert for second insert use.

2002-08-02 Thread Cédric Dufour (Cogito Ergo Soft)
You can retrieve the last inserted sequence value using: currval('t_task_task_id_seq') This is connection safe, so you get the the last ID inserted by YOUR connection. > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED]]On Behalf Of Ken Corey > Sent: Monday

[SQL] Returning PK of first insert for second insert use.

2002-08-02 Thread Peter Atkins
All, I have two tables t_proj, t_task see below: CREATE TABLE t_proj ( proj_id SERIAL NOT NULL, PRIMARY KEY (proj_id), task_id integer(12), user_id integer(6), title varchar(35), description varchar(80) ); CREATE TABLE t_task ( task_id SERIAL NOT NULL, PRIMARY KEY (task_id), title varchar(35),

[SQL] How to optimize SQL query ?

2002-08-02 Thread Milosz Krajewski
How to optimize query or just force postgre to do it my way ? Example: table continets ( id numeric, ..., active numeric ); table countries ( id numeric, id_continent numeric, ..., active numeric ); table cities ( id numeric, id_country numeric, ..., active numeric ); r

Re: [SQL] Returning PK of first insert for second insert use.

2002-08-02 Thread Ken Corey
On Mon, 2002-07-29 at 20:52, Peter Atkins wrote: > Is there a possibility of another application accessing the DB and using the > id before my function has completed the transaction? I'm concerned with the > possibility of cross-over of ID's if the insert hangs. > > There's no way to return the i

Re: [SQL] Change size of a field

2002-08-02 Thread ROUWEZ Stephane
Hi, Thank you, it works but I loose my foreign keys and the privileges for groups and users. Is there a solution ? Stef -Message d'origine- De : Achilleus Mantzios [mailto:[EMAIL PROTECTED]] Envoye : vendredi 26 juillet 2002 14:50 A : ROUWEZ Stephane Cc : '[EMAIL PROTECTED]'; LESNE P

[SQL] Transitive Closure

2002-08-02 Thread Suhas Joshi
Question from a Postgresql newbie. Does Postgresql have transitive closure feature in psql? Where can I find some documentation and examples on it? Thanks in advance ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] Please Help me

2002-08-02 Thread Jochem van Dieten
Michelle Murrain wrote: > > Yeah, except I do have experience with ColdFusion, and ColdFusion > runs into some very problematic issues with Postgres, sadly. Although > I use Postgres almost exclusively, I had to switch to MySQL for use > with ColdFusion. I wonder what your issues are, because in

[SQL] Random resultset retrieving -> performance bottleneck

2002-08-02 Thread Cédric Dufour
Hello to all of you, I'm running into a performance problem when considering the following scenario: I have a fairly large table (1mio rows) related to other smaller tables (between 100 and 1 rows) and would like to retrieve the joined data (through a view) in random order. In order to do so,

Re: [SQL] [ADMIN] 3-tier

2002-08-02 Thread Chad R. Larson
At 04:28 AM 7/31/02 , Elielson Fontanezi wrote: >I'm interested in programming a first prototype to demonstrate 3-tier >programming using PostGRE database. We're using FreeBSD/Apache for web servers, Macromedia JRun for the servlet container and PostgreSQL for the back-end database. We've just

[SQL] Group And Sort After Union

2002-08-02 Thread cnliou
Greetings! I want to GROUP BY and ORDER BY on the result of UNION similar to the following (wrong) SQL: (SELECT c11 AS c1,SUM(c12) AS c2 FROM table1 UNION SELECT c21 AS c1,SUM(c22) AS c2 FROM table2 ) GROUP BY c1 ORDER BY c2; Please note that the following is NOT what I want because it generate

Re: [SQL] Returning PK of first insert for second insert use.

2002-08-02 Thread Ken Corey
On Mon, 2002-07-29 at 19:32, Peter Atkins wrote: > I have two tables t_proj, t_task see below: > > CREATE TABLE t_proj ( > proj_id SERIAL NOT NULL, > PRIMARY KEY (proj_id), > task_id integer(12), > user_id integer(6), > title varchar(35), > description varchar(80) > ); > > CREATE TABLE t_task (

[SQL] How to get binary data from pgsql function

2002-08-02 Thread MaksimRomanov
Hi       I want to return miltiplie row data from stored procedure in binary format; I use "libpq++" DLL for access to PostgreSql and I want to take binary data from pointer returned by PgDatabase::GetData(int,int).     I have found only one way to receive binary data from backend - to use