Re: [GENERAL] rules

2004-11-25 Thread Daniel Martini
Hi, Citing Jamie Deppeler <[EMAIL PROTECTED]>: > sample sql querty > > INSERT INTO schema.table2 > ( > "field1", > "field2", > "field3", > "field4", > "field5", > "field6", > "field7", > "field8", > "field9", > ) > VALUES > ( > SELECT >

[GENERAL] PostgreSQL slow after VACUUM

2004-11-25 Thread Nikola Milutinovic
Hi all. I have the following: - Mandrake Linux 9.1 - PostgreSQL 7.3.2 MDK5 There is one DB and one DB user. The DB is cleared and loaded with the data of same volume each month (monthly report). The volume is not small and it usually takes 3 hours to load. Loading is done with SQL files which us

[GENERAL] rules

2004-11-25 Thread Jamie Deppeler
This may be a bit of stupid question but it is the first time i have played around with rules and i am trying to convert a sql statement into a rule sample sql querty INSERT INTO schema.table2 ( "field1", "field2", "field3", "field4", "field5", "field6", "field7",

Re: [GENERAL] off Topic: Looking for a good sql query

2004-11-25 Thread felix
On Fri, Nov 26, 2004 at 01:19:59PM +1100, Jamie Deppeler wrote: > This post is a bit off topic im looking a good sql book can someone give > me a recommendation? I am a middling SQL guy; I have used functions, triggers, outer joins, etc, but not often. But I've been doing that for years :-) my

Re: [GENERAL] off Topic: Looking for a good sql query

2004-11-25 Thread Jim Seymour
Jamie Deppeler <[EMAIL PROTECTED]> wrote: > > Hi, > > This post is a bit off topic im looking a good sql book can someone give > me a recommendation? I was pleased with... The Practical SQL Handbook Third Edition Judith S. Bowman, Sandra L. Emerson, & Marcy Darnovsky Addison-Wesley Developers

[GENERAL] pg_dump and languages

2004-11-25 Thread Adrian Klaver
I used the pg_dump from Postgres 8.0beta5 to dump the data from a version 7.4.0 database. Both databases are located on SuSE Linux machines. The pg_restore to the 8.0 version went very well with the exception of the languages. I have plpgsql and plsh installed in the 7.4.0 database. pg_dump han

[GENERAL] row-level deadlock problem

2004-11-25 Thread Kamil Kaczkowski
Hello. I'm running postgresql 7.4.6 on linux 2.4.21(Redhat Enterpise 3). I have problems with deadlocks caused by(at least I think so) row-level locks and I can't find the reason. First I thought this has something with fk constraints, but removing it didn't change anything. Here is simplified sch

[GENERAL] off Topic: Looking for a good sql query

2004-11-25 Thread Jamie Deppeler
Hi, This post is a bit off topic im looking a good sql book can someone give me a recommendation? ---(end of broadcast)--- TIP 1: subscribe and unsubscribe commands go to [EMAIL PROTECTED]

[GENERAL] RSS date still broken

2004-11-25 Thread Gaetano Mendola
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi all, how I already wrote, the RSS feed report as date: 1 jan 1970 for all entries. Regards Gaetano Mendola -BEGIN PGP SIGNATURE- Version: GnuPG v1.2.5 (MingW32) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFBpnIY7

Re: [GENERAL] What is alias_list_srl() ?

2004-11-25 Thread Neil Conway
On Thu, 2004-11-25 at 15:00 -0500, Fred Fung wrote: > I am running PostgreSQL 7.4.5 and I notice the following 2 sets of > error messages generated by the postmaster everything I do a query > through my frontend application program The source of the errors is your frontend application, not Postgre

Re: [GENERAL] Index work around?

2004-11-25 Thread Neil Conway
On Thu, 2004-11-25 at 10:24 +0100, Bjørn T Johansen wrote: > do I still need to use ::int8 to > make it use indexes in 8.0 as I need in 7.x? That should no longer be necessary. -Neil ---(end of broadcast)--- TIP 1: subscribe and unsubscribe comm

Re: [GENERAL] Using IN with subselect

2004-11-25 Thread Greg Stark
Dave Smith <[EMAIL PROTECTED]> writes: > That's what I wanted it to do I just did not understand how to read the > explain. So is it HashAggregate that means this already loaded? The HashAggregate Node is doing a GROUP BY command. (or the implicit GROUP BY if you used an aggregate function witho

[GENERAL] What is alias_list_srl() ?

2004-11-25 Thread Fred Fung
Hi,   I am running PostgreSQL 7.4.5 and I notice the following 2 sets of error messages generated by the postmaster everything I do a query through my frontend application program (the application executes the same block of codes every time, except the querying criteria is different dependin

Re: [GENERAL] Using IN with subselect

2004-11-25 Thread Dave Smith
That's what I wanted it to do I just did not understand how to read the explain. So is it HashAggregate that means this already loaded? On Thu, 2004-11-25 at 12:57, Tom Lane wrote: > Dave Smith <[EMAIL PROTECTED]> writes: > > Well here is explain. I would guess that it is executed each time .. > >

Re: [GENERAL] How can I change a cast from explicit only to implicit?

2004-11-25 Thread Julian Scarfe
From: "Tom Lane" <[EMAIL PROTECTED]> > > So how can I force a built-in cast to become implicit? > > If you're intent on doing that, you can change its entry in pg_cast. > But I think you'd be far better off to fix your application. Implicit > casts across type categories have a habit of kicking i

Re: [GENERAL] Using IN with subselect

2004-11-25 Thread Tom Lane
Dave Smith <[EMAIL PROTECTED]> writes: > Well here is explain. I would guess that it is executed each time .. > function any different? > HashAggregate (cost=288.32..288.32 rows=1 width=32) >-> Hash IN Join (cost=288.18..288.31 rows=1 width=32) > -> Subquery Scan journal_all (cos

Re: [GENERAL] Using IN with subselect

2004-11-25 Thread Martijn van Oosterhout
Running EXPLAIN over the query will tell you... On Thu, Nov 25, 2004 at 11:49:06AM -0500, Dave Smith wrote: > I have a query with an in subquery like > > where x in (select x from y); > > Now the subquery is not related to the outer query so it always returns > the same set. Is this subselect ex

Re: [GENERAL] Using IN with subselect

2004-11-25 Thread Dave Smith
Well here is explain. I would guess that it is executed each time .. function any different? HashAggregate (cost=288.32..288.32 rows=1 width=32) -> Hash IN Join (cost=288.18..288.31 rows=1 width=32) Hash Cond: (("outer".gl_num)::text = lpad(ltrim(("inner".account_num)::text, '0'::te

Re: [GENERAL] Using IN with subselect

2004-11-25 Thread Martijn van Oosterhout
On Thu, Nov 25, 2004 at 12:19:23PM -0500, Dave Smith wrote: > Well here is explain. I would guess that it is executed each time .. > function any different? Hmm, if it's only executed once I would expect it to be an InitPlan. Are you sure it's not correlated? If you want to make sure, put the sub

[GENERAL] How can I change a cast from explicit only to implicit?

2004-11-25 Thread Julian Scarfe
In 7.2.x template1=# select point('1'::text, '2'::text); point --- (1,2) (1 row) but in 7.4.x template1=# select point('1'::text, '2'::text); ERROR: function point(text, text) does not exist HINT: No function matches the given name and argument types. You may need to add explicit type ca

Re: [GENERAL] why use SCHEMA? any real-world examples?

2004-11-25 Thread Greg Stark
> > Since the manual says HOW, could anyone here who has used schemas take > > a minute to describe to a newbie like me why you did? What benefits > > did they offer you? Any drawbacks? I suspect the consumer of this feature for whom it would make the biggest difference would be shrinkwrapped

[GENERAL] Using IN with subselect

2004-11-25 Thread Dave Smith
I have a query with an in subquery like where x in (select x from y); Now the subquery is not related to the outer query so it always returns the same set. Is this subselect executed each time or just once? If it is executed each time, if I create a function would that then be only executed once?

Re: [GENERAL] VACUUM ANALYZE question - PostgreSQL performance tests

2004-11-25 Thread Tom Lane
Julian Legeny <[EMAIL PROTECTED]> writes: >PROBLEM IS, that when I start to retrieve records, the performance > is poor. But when I execute manually (from a DB client) query VACUUM > ANALYZE one more time (during retrieving of pages), the performance is > much better. I don't think this has an

Re: [GENERAL] SPI memory overrun details

2004-11-25 Thread Tom Lane
"Katsaros Kwn/nos" <[EMAIL PROTECTED]> writes: > I read in the documentation of SPI functions that an SPI_cursor is used > to avoid memory overrun in cases where a query returns many rows. I'd > like to learn more about this. Is their any place that I could find more > detailed information (e.g. ma

[GENERAL] Happy Thanksgiving

2004-11-25 Thread Joshua D. Drake
Hello, Command Prompt, Inc. would like to thank everyone in the community for making PostgreSQL what it is. The best Open Source Database, period. Happy Thanksgiving everyone. We hope you have a safe and happy holiday. Sincerely, Joshua D. Drake President Command Prompt, Inc. -- Command Prompt, Inc

Re: [GENERAL] table name in pl/pgsql

2004-11-25 Thread CoL
hi, ON.KG wrote: New question: i have tables like table_20041124, table_20041125, etc... i'm trying to make function (for example): = CREATE FUNCTION get_count(text, text) RETURNS int2 AS ' DECLARE cnt int4; BEGIN SELECT INTO cnt COUNT(*) FROM tab

Re: [GENERAL] table name in pl/pgsql

2004-11-25 Thread Tino Wildenhain
Hi, Am Donnerstag, den 25.11.2004, 19:42 +0300 schrieb ON.KG: > New question: > > i have tables like > table_20041124, > table_20041125, > etc... > > i'm trying to make function (for example): > = > CREATE FUNCTION get_count(text, text) > RETURNS int2 AS ' >

Re: [GENERAL] table name in pl/pgsql

2004-11-25 Thread Richard Huxton
Adam Witney wrote: I think you would have to do it something like this, although whether the SELECT INTO works in an EXECUTE context I am not sure (note, completely untested code!) CREATE FUNCTION get_count(text, text) RETURNS int2 AS ' DECLARE cnt int4; BEGIN EXECUTE ''SELECT INTO cnt COUNT

Re: [GENERAL] table name in pl/pgsql

2004-11-25 Thread Adam Witney
I think you would have to do it something like this, although whether the SELECT INTO works in an EXECUTE context I am not sure (note, completely untested code!) CREATE FUNCTION get_count(text, text) RETURNS int2 AS ' DECLARE cnt int4; BEGIN EXECUTE ''SELECT INTO cnt COUNT(*) FROM table_''

[GENERAL] VACUUM ANALYZE question - PostgreSQL performance tests

2004-11-25 Thread Julian Legeny
Hello, I have the question about VACUUM ANALYZE. I have try to do Postgres performance tests for selecting large amount of records from DB. First I have insert 30.000 records into the 1 table. After this insert I executed VACUUM ANALYZE query. I have a test that retrieves page by page (20

[GENERAL] table name in pl/pgsql

2004-11-25 Thread ON.KG
New question: i have tables like table_20041124, table_20041125, etc... i'm trying to make function (for example): = CREATE FUNCTION get_count(text, text) RETURNS int2 AS ' DECLARE cnt int4; BEGIN SELECT INTO cnt COUNT(*) FROM table_$1

Re: [GENERAL] Benchmark-Comparison PostGreSQL vs. SQL Server

2004-11-25 Thread Richard Huxton
Shridhar Daithankar wrote: Do we have some sort of document about how caching on windows works? It is very simple on linux and BSDs but for other OSs, I haven't seen many suggestions. I am sure OS specific hints would help OP a lot. Microsoft's own resources are good for this sort of stuff (apol

[GENERAL] Insert (ignore) with unique constraint on

2004-11-25 Thread Victor Ciurus
Hi all, What I'am trying to do using Postgresql is to make and "INSERT into table A (2 fields) (select * from Table B) - (2 fields + unique btree Index)" or a "COPY table_B from FILE using...". The problem is that everytime I get duplicates from table A into table B the insert will stop with the t

[GENERAL] SPI memory overrun details

2004-11-25 Thread Katsaros Kwn/nos
Hi, I read in the documentation of SPI functions that an SPI_cursor is used to avoid memory overrun in cases where a query returns many rows. I'd like to learn more about this. Is their any place that I could find more detailed information (e.g. max size of results, threshold - available memory et

Re: [GENERAL] why use SCHEMA? any real-world examples?

2004-11-25 Thread Daniel Martini
Hi, Citing Miles Keaton <[EMAIL PROTECTED]>: > I just noticed PostgreSQL's schemas for my first time. > (http://www.postgresql.org/docs/current/static/ddl-schemas.html) > > I Googled around, but couldn't find any articles describing WHY or > WHEN to use schemas in database design. When your dat

Re: [GENERAL] Benchmark-Comparison PostGreSQL vs. SQL Server

2004-11-25 Thread Shridhar Daithankar
On Thursday 25 Nov 2004 6:22 pm, Richard Huxton wrote: > > On the other hand, if an application has to "fight" against the file > > system, I would suppose it to increase RAM and CPU usage > > significantly. > > It shouldn't be fighting the file system, but it does use it, and rely > on it for cac

Re: [GENERAL] Trigger before insert

2004-11-25 Thread ON.KG
Hi! >> How could i stop Inserting record into table by some condition? RH> RETURN null when using a before trigger. Or raise an exception to abort RH> the whole transaction. Thanx ;) RETURN NULL works so as i need ---(end of broadcast)--- TIP 5:

Re: [GENERAL] Trigger before insert

2004-11-25 Thread Richard Huxton
ON.KG wrote: How could i stop Inserting record into table by some condition? RETURN null when using a before trigger. Or raise an exception to abort the whole transaction. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 1: subscribe

Re: [GENERAL] Benchmark-Comparison PostGreSQL vs. SQL Server

2004-11-25 Thread Richard Huxton
Robert Soeding wrote: 1. What configuration changes have you made? None, both installations are default configured. You'll want to do at least some tuning on PG. Try the URL below for a quick introduction - just the basic stuff is a good start. http://www.varlena.com/varlena/GeneralBits/Tidbits/p

Re: [GENERAL] Benchmark-Comparison PostGreSQL vs. SQL Server

2004-11-25 Thread Robert Soeding
> 1. What configuration changes have you made? None, both installations are default configured. > 2. How many concurrent connections was this? One. > 3. Were you selecting 1000 rows (LIMIT 1000), selecting all the rows > (and only fetching 1000) or actually defining an SQL cursor. I used "LIM

Re: [GENERAL] Benchmark-Comparison PostGreSQL vs. SQL Server

2004-11-25 Thread Richard Huxton
Robert Soeding wrote: Hi, this is my first question here, and also, it's somewhat delicate. So please be patient. My question is, CAN PostGreSQL perform in the SQL Server area when it comes to speed? In other words, are there explanations for the results I found (see below)? Faster in some cases, s

Re: [GENERAL] How to display structure of a table

2004-11-25 Thread Chris Green
On Thu, Nov 25, 2004 at 10:47:33AM +, Chris Green wrote: > On Thu, Nov 25, 2004 at 04:08:30PM +0530, Nageshwar Rao wrote: > >I have created a table and would like to display the structure to find > >out datatype and length. > > > >Just like in Oracle describe table_name; > > in ps

Re: [GENERAL] [HACKERS] Help!

2004-11-25 Thread Richard Huxton
ElayaRaja S wrote: Hi, Thanks for your reply. Sorry to contact again to this mail. I am unable to find the link for general list. Please let me know. That's fine - I'm cc-ing you to the general list so others can help too. You can find all the lists at http://www.postgresql.org/lists.html - you

Re: [GENERAL] How to display structure of a table

2004-11-25 Thread Chris Green
On Thu, Nov 25, 2004 at 04:08:30PM +0530, Nageshwar Rao wrote: >I have created a table and would like to display the structure to find >out datatype and length. > >Just like in Oracle describe table_name; in psql:- \dt Basically the \d commands in psql give you much of what DESC

[GENERAL] How to display structure of a table

2004-11-25 Thread Nageshwar Rao
I have created a table and would like to display the structure to find out datatype and length. Just like in Oracle describe table_name;

[GENERAL] Benchmark-Comparison PostGreSQL vs. SQL Server

2004-11-25 Thread Robert Soeding
ï Hi, this is my first question here, and also, it's somewhat delicate. So please be patient.   My question is, CAN PostGreSQL perform in the SQL Server area when it comes to speed? In other words, are there explanations for the results I found (see below)?   Thanks, Robert  

Re: [GENERAL] why use SCHEMA? any real-world examples?

2004-11-25 Thread Gregory S. Williamson
As other posters have indicated, there's a convenience factor and an advantage to compartmentalizing data. In our case we don't care so much about user rights (a very useful aspect in and of itself), but more for performance issues. We have some applications that use a lot of detailed data abou

Re: [GENERAL] [HACKERS] Help!

2004-11-25 Thread Richard Huxton
ElayaRaja S wrote: Hi, While configuring OpenCRX by using Postgresql i am facing probmelm. The problem while creating db using the command ( createdb -h localhost -E utf8 -U system crx-CRX ) . Erro: createdb: could not connect to database template1: could not connect to server: Connection refu

Re: [GENERAL] why use SCHEMA? any real-world examples?

2004-11-25 Thread Richard Huxton
Miles Keaton wrote: Since the manual says HOW, could anyone here who has used schemas take a minute to describe to a newbie like me why you did? What benefits did they offer you? Any drawbacks? Well - it's a namespace feature, so at its simplest it lets you have two objects with the same name.

[GENERAL] why use SCHEMA? any real-world examples?

2004-11-25 Thread Net Virtual Mailing Lists
I am in the middle of a project to convert non-schema databases to a schema-based system. The main reason I am doing it is because I need to do a join on tables between databases, which can only be done with an contrib module which does not have all the "features" one might want (such as use of in

[GENERAL] Trigger before insert

2004-11-25 Thread ON.KG
Hi all, === CREATE FUNCTION trigger_test_func() RETURNS trigger AS ' DECLARE cnt int4; BEGIN SELECT INTO cnt COUNT(*) FROM table_test WHERE ip = new.ip; IF cnt > 50 THEN -- THERE THE "INSERT" HAS TO BE STOPED END IF; RETURN new; END;'

[GENERAL] VACUUM ANALYZE question - PostgreSQL performance tests

2004-11-25 Thread juleni
Hello, I have the question about VACUUM ANALYZE. I have try to do Postgres performance tests for selecting large amount of records from DB. First I have insert 30.000 records into the 1 table. After this insert I executed VACUUM ANALYZE query. I have a test that retrieves page by page (2

Re: [GENERAL] select into temp tables withough using EXECUTE in plpgsql

2004-11-25 Thread Richard Huxton
Edmund Kleiser wrote: So to recap I'm creating a temp table fine. I'm EXCUTING an insert into the temp table fine. Then I cannot select from the table in the form: SELECT INTO int1 count(distinct(value)) from TEMP1; The following creates a table, populates it and selects from it using an EXECUTE.

[GENERAL] Index work around?

2004-11-25 Thread Bjørn T Johansen
Does 8.0 change the way PostgresSQL uses indexes? I.e. do I still need to use ::int8 to make it use indexes in 8.0 as I need in 7.x? Regards, BTJ -- --- Bjørn T Johansen [EMAIL PROTECTED] --

Re: [GENERAL] HELP speed up my Postgres

2004-11-25 Thread Anatoly Okishev
SQL: update SUBSCRIPTIONTABLE set ACTIVEFLAG='Y' where mobile_num in (select mobile_num from LOADED_MOBILE_NUMBERS) You can try this: update SUBSCRIPTIONTABLE, LOADED_MOBILE_NUMBERS set SUBSCRIPTIONTABLE.ACTIVEFLAG='Y' where LOADED_MOBILE_NUMBERS.mobile_num=SUBSCRIPTIONTABLE.mobile_num Anatoly.

Re: [GENERAL] why use SCHEMA? any real-world examples?

2004-11-25 Thread Markus Wollny
Hi! It's really just a convenience-thing to organize your data in a more intuitive way. We're running several online magazines, each of those with a sort of "entity-database", but each with their own articles. So we've just put the entity-data in the public schema, whereas the magazine-specific

Re: [GENERAL] tableoid

2004-11-25 Thread Richard Huxton
Jamie Deppeler wrote: Hi have a bit of a issue im planning on using tableoid to select the appropate table, but im not sure that you can in sql select statement? If not is there another approch i could be using? Can you explain what you are trying to do? -- Richard Huxton Archonet Ltd ---