Re: [SQL] the best way to get the topest 3 record in every group

2002-09-09 Thread jack
Dima My question is that I want to produce ALL the lastest 3 records for EACH itemNo and supplier. Jack - Original Message - From: "dima" <[EMAIL PROTECTED]> To: "jack" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, September 09, 2002 4:34 PM Subject: Re: [SQL] the best way to

Re: [SQL] the best way to get the topest 3 record in every group

2002-09-09 Thread Viacheslav N Tararin
jack : select * from purchase as p where purchase_date >= ( select min(ppp.purchase_date) from (select pp.purchase_date from purchase as pp where p.item_no = pp.item_no

Re: [SQL] the best way to get the topest 3 record in every group

2002-09-09 Thread Viacheslav N Tararin
jack : select * from purchase as p where purchase_date >= ( select min(ppp.purchase_date) from (select pp.purchase_date from purchase as pp where p.item_no = pp.item_no

Re: [SQL] the best way to get the topest 3 record in every group

2002-09-09 Thread Viacheslav N Tararin
jack : select * from purchase as p where purchase_date >= ( select min(ppp.purchase_date) from (select pp.purchase_date from purchase as pp where p.item_no = pp.item_no

[SQL] new calculated column

2002-09-09 Thread andres javier garcia garcia
Hi; I've got a table with two fields and about 3000 rows, the second one is a character field, what can have about twenty different values; of course these values are repeated a lot of times in the table. I need to create a new column of type integer, whose value depens on the character fields

[SQL] Character translation?

2002-09-09 Thread Linn Kubler
Hi, I have a view like this: create view myview as select recid, title, firstname || chr(32) || lastname as expert, rank from mytable; When I use this view via odbc on a Windows 2000 system using Visual FoxPro the expert field shows up as a memo field. This is analogous to the text field in P

[SQL] Efficiency Question

2002-09-09 Thread Colin Fox
Hi, all. I'm putting together a small query that should return the most recent entry from a table by date (I can't use an ID field as new entries may be added with older dates). It's not crucial that this run at 100% efficiency, but I'm interested in the results and/or discussion, as this will pr

[SQL] Slow Multi-joins performance

2002-09-09 Thread jlparkinson
Has the performance for queries with lots of joins (more than 5) been improved in v7.2 ? I'm using 7.0.3 on Redhat 7.1 on a K2-6 500 CPU, and it is about 3 times slower than MySQL, or Access on windoze platform :-( I tried different command-line optimisations, and got the best results (on oth

[SQL] Database joins

2002-09-09 Thread Jay
Hi, I have created two databases, db1 and db2  in my POSTGRESQL database system. And both the databases contains few tables also. Could you please help me to write a query which should retrieve data from both the databases (Database joins and table joins) Expecting and earliest reply Regard

[SQL] Cross tables Like%

2002-09-09 Thread Jason Davis
I have 2 tables, one is products and one is manufactors. The products table has a col. for Product_descriptions and manufactor_id column that is a foriegn key to the manufactors table. The manufactors table has a manfuactor_description column, for each unique Manufactor_id. I want to search (us

Re: [SQL] Efficiency Question

2002-09-09 Thread Bruno Wolff III
On Mon, Sep 09, 2002 at 00:13:04 +, Colin Fox <[EMAIL PROTECTED]> wrote: > > select >* > from >motm > order by >creation_date desc > limit 1; > > So in the first case I select the record that has the largest date. In the > second case, I order all the records, and then return o

Re: [SQL] new calculated column

2002-09-09 Thread Viacheslav N Tararin
For implicit modification you can use a trigger on the table. If you wan't store this data, you can use view. andres javier garcia garcia ?: >Hi; > >I've got a table with two fields and about 3000 rows, the second one is a >character field, what can have about twenty different values; of c

Re: [SQL] Cross tables Like%

2002-09-09 Thread Viacheslav N Tararin
select products.*, manufactors.* from products, manufactors where products.manufactor_id=manufactors.manufactor_id and ( products.product_description like 'param%' or manufactors.manufactor_description like 'param%'); regards Jason Davis ?: >I have 2 tables, one is products and one is manu

Re: [SQL] Character translation?

2002-09-09 Thread Richard Huxton
On Thursday 05 Sep 2002 11:15 pm, Linn Kubler wrote: > Hi, > > I have a view like this: > create view myview as > select recid, title, firstname || chr(32) || lastname as expert, rank > from mytable; > > When I use this view via odbc on a Windows 2000 system using Visual FoxPro > the expert fiel

Re: [SQL] Character translation?

2002-09-09 Thread Troy
Would this work? select recid, title, firstname || chr(32) || lastname::char(50) as expert, rank from mytable where length(lastname) <= 50; Troy > > Hi, > > I have a view like this: > create view myview as > select recid, title, firstname || chr(32) || lastname as expert, rank >

Re: [SQL] Slow Multi-joins performance [DEVELOPERS attn please]

2002-09-09 Thread Richard Huxton
On Friday 06 Sep 2002 11:59 am, [EMAIL PROTECTED] wrote: > Has the performance for queries with lots of joins (more than 5) been > improved in v7.2 ? > > I'm using 7.0.3 on Redhat 7.1 on a K2-6 500 CPU, and it is about 3 times > slower than MySQL, or Access on windoze platform :-( > > I tried diff

Re: [SQL] Database joins

2002-09-09 Thread Stephan Szabo
On Mon, 9 Sep 2002, Jay wrote: > Hi, > I have created two databases, db1 and db2 in my POSTGRESQL database system. > And both the databases contains few tables also. > Could you please help me to write a query which should retrieve data from both the >databases > (Database joins and table joins

Re: [SQL] Character translation?

2002-09-09 Thread Stephan Szabo
On Thu, 5 Sep 2002, Linn Kubler wrote: > Hi, > > I have a view like this: > create view myview as > select recid, title, firstname || chr(32) || lastname as expert, rank > from mytable; > > When I use this view via odbc on a Windows 2000 system using Visual FoxPro > the expert field shows up a

Re: [SQL] the best way to get the topest 3 record in every group

2002-09-09 Thread Masaru Sugawara
On Mon, 9 Sep 2002 18:08:21 +1000 "jack" <[EMAIL PROTECTED]> wrote: > Dima > My question is that I want to produce ALL the lastest 3 records for EACH > itemNo and supplier. > > Jack I often use the next query for ranking, which is equivalent to Oracle's PARTITION BY(). It isn't influenced by

Re: [SQL] Slow Multi-joins performance [DEVELOPERS attn please]

2002-09-09 Thread Ross J. Reedstrom
Richard - Your analysis of this looks right on, to me. With current code, if you put in explicit JOINS, the table get joined in that order, no questions. By specifying an all JOIN version, you've made the optimizers job very easy: only one plan to consider. Your point about realistic data and co

[SQL] Changing Column Type

2002-09-09 Thread Peter Atkins
All, Is there a way to easily change the type of column? Or do I have to drop and create again. From: assignment_notes | character varying(255) To: assignment_notes | text Thanks, -p ---(end of broadcast)--- TIP 1: subscribe and unsubscribe co

[SQL] Displaying current queries on the database?

2002-09-09 Thread Sloan Bowman
I was wondering if there is a way to display all of the current queries that are being submitted to the database. Thanks in advance. -Sloan Bowman ---(end of broadcast)--- TIP 4: Don't 'kill -9' the postmaster

Re: [SQL] Displaying current queries on the database?

2002-09-09 Thread mallah
its possible, select * from pg_stat_activity after AS connect as postgres. THOUGH NEEd to configure postgresql.conf accordigly regds mallaH > I was wondering if there is a way to display all of the current queries that are >being > submitted to the database. Thanks in advance. > > -Sloan

[SQL] stored procedures: sybase -> postgreSQL ?

2002-09-09 Thread Charles Hauser
I am trying to port a Sybase table create script to one usable for postgreSQL. (note I am not a DBA) In particular I am not well versed on how to use/recode the stored procedures such as that in the example below. ALTER TABLE DnaFragment ADD PRIMARY KEY (dna_fragment_id) go exec sp_p

Re: [SQL] Slow Multi-joins performance [DEVELOPERS attn please]

2002-09-09 Thread Tom Lane
Richard Huxton <[EMAIL PROTECTED]> writes: > Which says to me that your form is fine. Testing says otherwise, so there must > be some element of the query that is not being accounted for in EXPLAIN > ANALYSE. To wit, planning time. EXPLAIN ANALYZE only counts execution time. And planning time

[SQL] How the R-Tree index works?.

2002-09-09 Thread Andres Sommerhoff
Hi, Can someone explain my how the R-Tree index works?. I just buy a Postgres's Developer book, but it only mentioned it. Thanks.     Andrés Sommerhoff

[SQL] Transaction Newbie

2002-09-09 Thread Michelle Murrain
Hi, I've been using Postgres for a while, almost exclusively through the perl DBI (although I do plenty of work on the command line). I have realized, belatedly, that I need transactions for this thing I want to accomplish, but I've not done transactions before, so I need a bit of help. And,

Re: [SQL] Transaction Newbie

2002-09-09 Thread Christopher Kings-Lynne
> if the primary key is table_id, with default value > "nextval('table_seq') - then these two statements: > > insert into table (field1,field2,field3) values (value1,value2,value3) > select currval('table_seq') > > work to get me the value I need. Except, of course if someone else > has inserted a

Re: [SQL] How the R-Tree index works?.

2002-09-09 Thread Markus Gieppner
Hi Andreas,   I asked myself the same question just yesterday. Here's something I found on google (and there's much more there, as usual!)   http://icg.harvard.edu/~cs265/lectures/readings/guttman-1984.pdf   Cheers,   Markus Gieppner   -Original Message-From: [EMAIL PROTECTED]

[SQL] pgsql-performance mailing list / newsgroup created

2002-09-09 Thread Marc G. Fournier
Morning all ... Josh Berkus the other day shook my cage a bit and reminded me to create the -performance list that had been discussed awhile back ... so I did :) [EMAIL PROTECTED] or comp.databases.postgresql.performance archives wont' show it up yet,