[SQL] Moving a simple function to pl/pgsql (Novice question)

2007-04-04 Thread Paul Lambert
Forgive me in advance for this terribly novice question... I have the following function which was written in MS SQL Servers trigger/rule language... CREATE TRIGGER [Sync_Deals] ON [dbo].[Deals] FOR INSERT, UPDATE AS begin declare @Found int declare @deal varchar(10)

[SQL] Generating dates prior to generate_series

2007-04-04 Thread Roger Tannous
I'm using PostgreSQL version 7.3.2, and generate_series() is not available, so this is a function to generate a series dates. The function goes backwards if the second argument is less than the first one. Check the two select statements at the end. Best Regards, Roger Tannous. CREATE FUNCTION

[SQL] CPU statistics

2007-04-04 Thread ezequias
Hi list, It is possible to retrieve information about the server hardware via postgreSQL ? Regards, -- Ezequias Rodrigues da Rocha ---(end of broadcast)--- TIP 5: don't forget to increase your free space map settings

Re: [SQL] plpgsql function question

2007-04-04 Thread John DeSoi
If you use a plpgsql function to select the row you want to validate, it will make life much easier. Something like ... $$ declare my_row a_row_type; is_ok integer; begin select into my_row * from a_row_type where is_ok := my_a_validate(my_row); return is_ok; $$ ... On Apr 4,

[SQL] Setting high performance on huge server

2007-04-04 Thread ezequias
Hi list, Could someone give me a little help with my settings ? How do I increase my performance knowing that my server is a huge server. Here some parameters I suppose are important on this settings: shared_buffers;8000kB;Sets the number of shared memory buffers used by the server.

Re: [SQL] Setting high performance on huge server

2007-04-04 Thread Claus Guttesen
How do I increase my performance knowing that my server is a huge server. Here some parameters I suppose are important on this settings: shared_buffers;8000kB;Sets the number of shared memory buffers used by the server. max_connections;100;Sets the maximum number of concurrent connections.

Re: [SQL] Moving a simple function to pl/pgsql (Novice question)

2007-04-04 Thread Richard Broersma Jr
--- Paul Lambert [EMAIL PROTECTED] wrote: The purpose being when a row in a table in one database is updated, it will copy (or replicate I guess) the record into a different table into another database in the same server. (deleting said record first if it already exists) What is the best

Solved - [SQL] best way: diary functions.

2007-04-04 Thread Gary Stainburn
My solution that works is: select date_range as rdate, case when rsgsid is not null then 2 when aid is not null then 1 else 0 end as status from date_range('2007-04-01','2007-04-30') left join availability a on a.asid = 1 and (date_range,date_range) overlaps

Re: [SQL] CPU statistics

2007-04-04 Thread Peter Eisentraut
Am Mittwoch, 4. April 2007 14:36 schrieb [EMAIL PROTECTED]: It is possible to retrieve information about the server hardware via postgreSQL ? You'd have to write your own function. -- Peter Eisentraut http://developer.postgresql.org/~petere/ ---(end of

Re: [SQL] CPU statistics

2007-04-04 Thread Jonah H. Harris
On 4/4/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: It is possible to retrieve information about the server hardware via postgreSQL ? Ezequias, Please read the manual and use Google. You're still asking two or three questions per day which could easily be answered in already published

Re: [SQL] Moving a simple function to pl/pgsql (Novice question)

2007-04-04 Thread Paul Lambert
Richard Broersma Jr wrote: --- Paul Lambert [EMAIL PROTECTED] wrote: The purpose being when a row in a table in one database is updated, it will copy (or replicate I guess) the record into a different table into another database in the same server. (deleting said record first if it already

[SQL] slow query

2007-04-04 Thread Sumeet
Hi all I ran a simple query like the one displayed below and it takes a lot of time to execute on this table. This table has 48 million recordsand i worry about this table a lot coz i need to perform join on this table with some other table having around 13 million recordsI've tried

Re: [SQL] Very slow DELETE on 4000 rows of 55000 row table

2007-04-04 Thread Bryce Nesbitt
Tom Lane wrote: Bryce Nesbitt [EMAIL PROTECTED] writes: I've got a DELETE FROM that seems to run forever, pegging the CPU at 100%. I can't figure out why it's slow. Any clues? Unindexed foreign key constraints pointing to this table, perhaps? EXPLAIN ANALYZE would give a great

Re: [SQL] Very slow DELETE on 4000 rows of 55000 row table

2007-04-04 Thread Richard Broersma Jr
But I DELETE all conflicting those rows prior to the slow DELETE, just so the FK check is never hit. Should I be looking at subverting the FK check mechanism somehow? The necessary index would be huge, and relevant only on this particular operation which happens every few months, if that.

Re: [SQL] slow query

2007-04-04 Thread A. Kretschmer
am Wed, dem 04.04.2007, um 23:17:54 -0400 mailte Sumeet folgendes: sm= explain analyze select * from ma limit 10; QUERY PLAN

Re: [SQL] Very slow DELETE on 4000 rows of 55000 row table

2007-04-04 Thread Tom Lane
Richard Broersma Jr [EMAIL PROTECTED] writes: But I DELETE all conflicting those rows prior to the slow DELETE, just so the FK check is never hit. Should I be looking at subverting the FK check mechanism somehow? The necessary index would be huge, and relevant only on this particular

Re: [SQL] slow query

2007-04-04 Thread Tom Lane
A. Kretschmer [EMAIL PROTECTED] writes: am Wed, dem 04.04.2007, um 23:17:54 -0400 mailte Sumeet folgendes: sm= explain analyze select * from ma limit 10; QUERY PLAN

Re: [SQL] slow query

2007-04-04 Thread A. Kretschmer
am Thu, dem 05.04.2007, um 1:27:25 -0400 mailte Tom Lane folgendes: A. Kretschmer [EMAIL PROTECTED] writes: am Wed, dem 04.04.2007, um 23:17:54 -0400 mailte Sumeet folgendes: sm= explain analyze select * from ma limit 10; QUERY PLAN