Re: [GENERAL] Improve a query...

2001-05-02 Thread Peter Eisentraut
Eric G. Miller writes: > If max(period) for an organization yields the most recent reporting, > I want to get whatever is the most recent report for each organization. SELECT org_id, max(period) FROM reports GROUP BY org_id; -- Peter Eisentraut [EMAIL PROTECTED] http://funkturm.homeip.net/

[GENERAL] Perl Scope problem

2001-05-02 Thread Randall Perry
I'm baffled by perl's scoping of variables. In the code below, the $cust_data hash ref is inited outside the while loop. It's then set in the while with the results of a PgSQL query. In the if-else statement $cust_data can be seen in the 'if' but not in the 'else' (if I try to print a value in el

Re: [GENERAL] Tuple Max Size on 7.1

2001-05-02 Thread David Scholes
Sorry. Perl drivers are Okay. Our server was moved and pointing so I was pointing to an old version. After digging more into the CF problem it does appear to be the drivers. I changed the odbc.ini file to point to the new drivers that come with the distribution but CF still seems to try and us

Re: [GENERAL] Ideal hardware configuration for pgsql

2001-05-02 Thread Sean Chittenden
> Unfortunately there aren't any great java ports for FreeBSD. Check out the linux compatibility java support linux-jdk13 I've found it to be about 95% as fast as something running under native linux, but I get the perk of BSDs memory management and I can typically run 1.4 times

RE: [GENERAL] Ideal hardware configuration for pgsql

2001-05-02 Thread Willis, Ian (Ento, Canberra)
I think that all this fat should be put on the fire. A nice performance test on the same high end hardware would be good. Is there a test suite that would suit? Would anyone expect more than a 5% difference in performance between the OS's even using the dreaded ext2 and not the reiserfs or SGI XFS

Re: [GENERAL] Unique or Primary Key?

2001-05-02 Thread GH
On Wed, May 02, 2001 at 06:50:09PM -0700, some SMTP stream spewed forth: > On Thu, May 03, 2001 at 12:58:03AM +0100, [EMAIL PROTECTED] wrote: > > This table is man-in-the-middle of a many-to-many relationship: > > > > CREATE TABLE cv_entries ( > > subscriber INTEGER NOT NULL > >

Re: [GENERAL] Ideal hardware configuration for pgsql

2001-05-02 Thread Dave Cramer
While I certainly have to agree with all of the points regarding FreeBSD's ease of use, and security I have one major critisism. Unfortunately there aren't any great java ports for FreeBSD. Linux also enjoys the attention of many bigger players such as IBM, Compaq. Dave - Original Message --

[GENERAL] Re: DROP TABLE wildcard

2001-05-02 Thread Joel Burton
On Wed, 2 May 2001, Andy Koch wrote: > Is it possible to drop multiple tables with SQL on the system tables: > > I tried this: > > DROP TABLE from pg_tables where tablename LIKE 'table_num_%'; > > Which for whatever reason would delete 0 items despite it should have > matched on several. > >

Re: [GENERAL] Re: SQL Where Like - Range it?!

2001-05-02 Thread will trillich
On Mon, Apr 30, 2001 at 01:11:21AM -0400, Tom Lane wrote: > Always remember that the cost estimates quoted by EXPLAIN are estimates, > not reality. > > In this case the reason for the difference is that the planner doesn't > have any detailed understanding of the semantics of bracket-expressions

[GENERAL] Re: best way to implement producer/consumer in Perl

2001-05-02 Thread Joel Burton
On 2 May 2001, Vivek Khera wrote: > I've got an application that creates work and posts the work requests > to a table. Each work request is just a single row in the table. > I've also got two systems that do the work based on the requests in > the table. > > It seems that ideally, I could use

RE: [GENERAL] Improve a query...

2001-05-02 Thread Jeff Eckermann
Try: SELECT DISTINCT ON (org_id) rpt_id, org_id, period,... FROM reports ORDER BY period DESC; > -Original Message- > From: Eric G. Miller [SMTP:[EMAIL PROTECTED]] > Sent: Tuesday, May 01, 2001 4:04 AM > To: PostgreSQL General > Subject: [GENERAL] Improve a query... > > Looking fo

Re: [GENERAL] Cannot build PL/Perl ...

2001-05-02 Thread Andy Koch
At 09:59 PM 5/2/2001 +0200, you wrote: >Cannot build PL/Perl because libperl is not a shared library. >I'v got this error when I tried to compile PL/Perl. >I have SuSE Linux 7.0 , have I get a libperl.so library , and put it in >/usr /lib ... > >Thanks for any help >Adam Hi Adam, I went through g

[GENERAL] "group by" is quite expensive

2001-05-02 Thread Albertson, Chris
What can I do to speed up queries like the following select count(*) from ttt group by xxx; Using Postgres 7.1 on Solaris 8 the above query on a 1M row database takes 6 times longer than the following select count(*) from ttt; With Postgres "group by" is apparently quite expensive. Usi

[GENERAL] Strange SERIAL / Sequence error

2001-05-02 Thread Christian Marschalek
I create a table with: CREATE TABLE "tab" ("asdf" SERIAL, "asdf2" char (20) NOT NULL ); Then I try to insert some data: INSERT INTO "tab" ("asdf", "asdf2") VALUES (NEXTVAL('""tab_asdf_seq""'::text), 'asdf') ERROR: Relation '"tab_asdf_seq"' does not exist (done with phpPgAdmin 2.3) --

[GENERAL] Security and performance

2001-05-02 Thread pgsql
I'm writing the database backend to a web application. Being paranoid I want to limit the damage/exposure that the application can do. One way would be to create a database user for each application user (i.e. login name) and to create views for each user, not giving them any permissions on sens

RE: [GENERAL] Ideal hardware configuration for pgsql

2001-05-02 Thread Albertson, Chris
We just bought a brand new Sun Netra X1. List pice from Sun was $995.00. Yes under one grand. It is a 1U tall box. For once Sun beats Intel prices. It comes with Solaris 8 preinstaled. Basically just plug in and boot. We got a discount to $907. We upgraded the RAM to 1GB (it uses PC133 RAM

Re: [GENERAL] disk usage advice needed

2001-05-02 Thread Bruce Momjian
> Hello > > My data directory is like (pg 7.1 linux 2.4.4) > --- > $ ls > PG_VERSION base/ global/ pg_hba.conf pg_ident.conf pg_xlog/ postgresql.conf >postmaster.opts > > > With 7.0.3 I remember?? that there are files named according to table > names. With 7.1 I don't know which di

[GENERAL] Cannot build PL/Perl ...

2001-05-02 Thread Adam Walczykiewicz
Cannot build PL/Perl because libperl is not a shared library. I'v got this error when I tried to compile PL/Perl. I have SuSE Linux 7.0 , have I get a libperl.so library , and put it in /usr /lib ... Thanks for any help Adam -- ---(end of broadcast)--

Re: [GENERAL] big pg 6.5 and 7.1 problem in simple application

2001-05-02 Thread Doug McNaught
Aaron Brashears <[EMAIL PROTECTED]> writes: > We have a simple ad tracking application, which has a (mostly) fixed > table size where each row represents a particular ad. We have about 70 > rows in the database and use php scripts in apache which connect over > odbc, read a single row, increment

[GENERAL] DROP TABLE wildcard

2001-05-02 Thread Andy Koch
Is it possible to drop multiple tables with SQL on the system tables: I tried this: DROP TABLE from pg_tables where tablename LIKE 'table_num_%'; Which for whatever reason would delete 0 items despite it should have matched on several. Of course I'm not even sure pg_tables would be the smart

[GENERAL] PL/Perl documentation ...

2001-05-02 Thread Adam Walczykiewicz
Is there available some more examples of writing functions in PL/Perl ? In standard documentation there is only just 2 examples. Thanks in advance for any help. Adam -- ---(end of broadcast)--- TIP 6: Have you searched our list archives?

Re: [GENERAL] Update Triggers & NULLs

2001-05-02 Thread Doug McNaught
"Gregory Wood" <[EMAIL PROTECTED]> writes: > I have a plpgsql update trigger on one of my tables. The intention of the > trigger is to check to see if a particular field is updated, and if so > INSERT a record into another table. The IF statement looks something like > this: > > IF new.MyField <

[GENERAL] big pg 6.5 and 7.1 problem in simple application

2001-05-02 Thread Aaron Brashears
We have a simple ad tracking application, which has a (mostly) fixed table size where each row represents a particular ad. We have about 70 rows in the database and use php scripts in apache which connect over odbc, read a single row, increment a counter, and update that row. We're performing abou

[GENERAL] Re: update ... from where id in (..) question

2001-05-02 Thread Gregory Wood
> I have a table with approx. 2mln records. > > There were a few for which I had to update statusfield, so I did: > > update table set statusflag = 'U' where id in ('id10', 'id20', > 'id30'); > > this took so long that I cancelled it, and used separate > > update table set sta

RE: [GENERAL] update ... from where id in (..) question

2001-05-02 Thread Mike Mascari
This FAQ Item 4.23: 4.23) Why are my subqueries using IN so slow? Currently, we join subqueries to outer queries by sequentially scanning the result of the subquery for each row of the outer query. A workaround is to replace IN with EXISTS: SELECT * FROM tab WHERE col1 IN (SELECT col2 F

[GENERAL] Re: Stranger than fiction...

2001-05-02 Thread Gregory Wood
> This table currently has 224 rows of data in it. > > The following queries *ALL* take approx. .433 seconds to run. > > select * from status s where s.site_id = 18 and s.host_id = 49 and > s.product = 'BETA' and s.class = 'APPS' and s.subclass = 'MONITOR' ; > select * from status s where s.site_

[GENERAL] RE: Joining more than 2 tables

2001-05-02 Thread Joel Burton
On Wed, 2 May 2001, Jeff Meeks wrote: > What I am looking for is a query that will return a list of id's with a > sum from table b and a sum from table c like this: > > id namesum(b) sum(a) > 1 shell34 50 >

Re: [GENERAL] Re: Stranger than fiction - EXPLAIN results

2001-05-02 Thread Doug McNaught
Fran Fabrizio <[EMAIL PROTECTED]> writes: > Seq Scan on status s (cost=0.00..9.04 rows=1 width=84) > > 010502.11:24:05.003 [3029] CommitTransactionCommand > > Which is incorrect because it should be using my index, shouldn't > it? Here is how I created my index: If a table is small (you ha

Re: [GENERAL] Serial Type

2001-05-02 Thread Peter Eisentraut
Christian Marschalek writes: > The serial data type automaticaly takes the next higher value, but what > if there's a drop and I want to assing 3 even if there are 20 records > and the next higher number would be 21 not 3? Then you can't use the serial type. Coding hole-filling serial numbers c

[GENERAL] Re: Stranger than fiction - EXPLAIN results

2001-05-02 Thread Fran Fabrizio
I'm sorry that I did not send the EXPLAIN results along with my original email, I had no idea this command existed (I'm a first-week rookie with postgres!) Also, I did not know about vacuum, and apparently, that was the culprit! After vacuum'ing, times went from .433 sec/query to .001. Holy mol

RE: [GENERAL] Ideal hardware configuration for pgsql

2001-05-02 Thread Willis, Ian (Ento, Canberra)
I would make sure that an intel box won't suit before looking at sun. Simply for cost and if you're planning to run linux on it sun support will be shit because they don't have skills in that area. Databases thrive on more spindles, separate system spindles from the db spindles and swap spindles,

RE: [GENERAL] Ideal hardware configuration for pgsql

2001-05-02 Thread mkb
At 7:28 +0200 5/2/2001, Christian Marschalek wrote: >Maybe a AMD Athlon 1.33GHZ would be better.. It's a very fast CPU and I >don't know if PostgreSQL runns faster on dual since I don't know if it >can handle the load balancing? >Well.. GIG of Ram is never bad... :) I would think that dual CPU's

[GENERAL] update ... from where id in (..) question

2001-05-02 Thread Feite Brekeveld
Hi, I have a table with approx. 2mln records. There were a few for which I had to update statusfield, so I did: update table set statusflag = 'U' where id in ('id10', 'id20', 'id30'); this took so long that I cancelled it, and used separate update table set statusflag = 'U' w

[GENERAL] Update Triggers & NULLs

2001-05-02 Thread Gregory Wood
I have a plpgsql update trigger on one of my tables. The intention of the trigger is to check to see if a particular field is updated, and if so INSERT a record into another table. The IF statement looks something like this: IF new.MyField <> old.MyField THEN This works great when MyField has an

Re: [GENERAL] disk usage advice needed

2001-05-02 Thread newsreader
On Wed, May 02, 2001 at 10:45:09AM -0400, Bruce Momjian wrote: > > I wish these two tables to live on two separately. > > I just wrote two articles, one on performance and the other on writing > PostgreSQL applications. You can get them at: > > http://candle.pha.pa.us/main/writings/pgsql/

Re: [GENERAL] Serial Type

2001-05-02 Thread Justin Clift
Hi Chris, If you do an INSERT straight into the table, AND also make sure you give it the value you want in the serial column, it will accept it and not increment the serial column's counter. There are also a few function which are useful with the serial type : currval() setval() nextval() See

RE: [GENERAL] Ideal hardware configuration for pgsql

2001-05-02 Thread Christian Marschalek
> Tomorrow I'd like to place an order for something more > robust... looking > into dual PIII, gig of ram and SCSI Raid. Planning on > running Red Hat 7.1 > on this machine. Maybe a AMD Athlon 1.33GHZ would be better.. It's a very fast CPU and I don't know if PostgreSQL runns faster on dual

Re: [GENERAL] Re: do functions cache views?

2001-05-02 Thread Tom Lane
"Thomas F. O'Connell" <[EMAIL PROTECTED]> writes: >> If it's not those issues then we'll need more details --- preferably >> a self-contained example. > ok. here are some more details: You still have not given an example that would allow someone else to reproduce the behavior you think is broken

Re: [GENERAL] Improve a query...

2001-05-02 Thread Tom Lane
"Eric G. Miller" <[EMAIL PROTECTED]> writes: > Looking for the best way to formulate a query to select > the most "recent" entry for an organization in a table > like: Take a look at the SELECT reference page's example for SELECT DISTINCT ON: : For example, : : SELECT DISTINCT ON (loca

Re: [GENERAL] wierd problems with DBI/DBD::pg?

2001-05-02 Thread pmh
On Mon, 30 Apr 2001 14:50:15 -0400, Michelle Murrain wrote: > I recently upgraded from 6.5 to 7.1, and it mostly went smoothly (fixed the > PHP problem, thanks to a list member). But now some of my perl stuff is > being a bit strange, and I'm wondering whether other folks have noticed > strangen