Re: [SQL] Triggers using PL/pgSQL

2006-07-31 Thread Ken Hill
On Sun, 2006-07-30 at 21:16 -0700, Thusitha Kodikara wrote: > Hello, > > I am interested in developing some triggers to keep track of records > that are changed (possibly the changes of one or more specific > columns). In addition to keeping the new values, I also need to keep > the old values (ma

Re: [SQL] Slow update SQL

2006-02-28 Thread Ken Hill
suggestion is try to change the query to: ... WHERE dxdate >= '2001-01-01'; I hope this helps. Regards, bungsu - Original Message ----- From: Ken Hill To: Postgres Help Sent: Tuesday, February 14, 2006 8:48 AM Subject: [SQL] Slow update SQL I'm experiencing a very slow query.

Re: [SQL] Modifying postgresql.org file

2006-02-15 Thread Ken Hill
On Wed, 2006-02-15 at 18:09 +0100, Peter Eisentraut wrote: Ken Hill wrote: > Can someone point me in a > direction as to where I can learn how to modify the postgresql.org > file to increase work_mem? RTFM I apologize for my lack of knowledge, but what is "RTFM"?

Re: [SQL] Modifying postgresql.org file

2006-02-15 Thread Ken Hill
On Wed, 2006-02-15 at 11:20 -0500, Andrew Sullivan wrote: On Wed, Feb 15, 2006 at 08:15:46AM -0800, Ken Hill wrote: > It has been suggested to me to increase my work_mem to make queries > preform faster. I believe I do this in the 'postgresql.org' file. I > seem to have

[SQL] Modifying postgresql.org file

2006-02-15 Thread Ken Hill
It has been suggested to me to increase my work_mem to make queries preform faster. I believe I do this in the 'postgresql.org' file.  I seem to have two of these files: /etc/postgresql/7.4/main/postgresql.org /usr/share/postgresql/7.4/postgresql.conf.sample I believe the second one is an exa

Re: [SQL] Non Matching Records in Two Tables

2006-02-15 Thread Ken Hill
On Tue, 2006-02-14 at 15:05 -0800, Bryce Nesbitt wrote: Ken Hill wrote: >> also (hate to be obvious) have you analyzed lately? >> I'd say that's fair game, not obvious. Vacuum/Analyze is ar so aparent to a person moving to Postgres from other DB's. ---

Re: [SQL] Non Matching Records in Two Tables

2006-02-14 Thread Ken Hill
On Tue, 2006-02-14 at 13:24 -0800, Ken Hill wrote: On Tue, 2006-02-14 at 13:08 -0800, chester c young wrote: > Here is my query SQL: > > SELECT key100 FROM ncccr10 > WHERE ncccr10.key100 NOT IN (SELECT key100 FROM ncccr9); > > It is is running after 30 minutes.

Re: [SQL] create table and data types

2006-02-14 Thread Ken Hill
On Tue, 2006-02-14 at 23:03 +0100, Maciej Piekielniak wrote: Hello Ken, Tuesday, February 14, 2006, 10:30:34 PM, you wrote: KH> On Tue, 2006-02-14 at 22:12 +0100, Maciej Piekielniak wrote: >> Hello pgsql-sql, >> >> Is anybody know how create field in a new table with data type accuiring

Re: [SQL] create table and data types

2006-02-14 Thread Ken Hill
On Tue, 2006-02-14 at 22:12 +0100, Maciej Piekielniak wrote: Hello pgsql-sql, Is anybody know how create field in a new table with data type accuiring from a field in other table? For example: create table new_table ( name other_table.name%TYPE ); Have you tried inheritance from o

Re: [SQL] Non Matching Records in Two Tables

2006-02-14 Thread Ken Hill
On Tue, 2006-02-14 at 16:07 -0500, Tom Lane wrote: Ken Hill <[EMAIL PROTECTED]> writes: > Seq Scan on ncccr10 (cost=0.00..20417160510.08 rows=305782 width=104) >Filter: (NOT (subplan)) >SubPlan > -> Seq Scan on ncccr9 (cost=0.00..65533.71 rows=494471

Re: [SQL] Non Matching Records in Two Tables

2006-02-14 Thread Ken Hill
On Tue, 2006-02-14 at 13:08 -0800, chester c young wrote: > Here is my query SQL: > > SELECT key100 FROM ncccr10 > WHERE ncccr10.key100 NOT IN (SELECT key100 FROM ncccr9); > > It is is running after 30 minutes. Here is the query plan: > I would try an outer join: select a.key100 from nccc

Re: [SQL] Non Matching Records in Two Tables

2006-02-14 Thread Ken Hill
On Wed, 2006-02-08 at 22:31 +0100, Markus Schaber wrote: Hi, Ken, Ken Hill schrieb: > I need some help with a bit of SQL. I have two tables. I want to find > records in one table that don't match records in another table based on > a common column in the two tables. Both

Re: [SQL] Slow update SQL

2006-02-14 Thread Ken Hill
On Mon, 2006-02-13 at 22:17 -0700, Michael Fuhr wrote: [Please copy the mailing list on replies.] On Mon, Feb 13, 2006 at 06:48:06PM -0800, Ken Hill wrote: > On Mon, 2006-02-13 at 19:14 -0700, Michael Fuhr wrote: > > How many rows does the condition match? > > csalgorithm

[SQL] Slow update SQL

2006-02-13 Thread Ken Hill
I'm experiencing a very slow query. The table contains 611,564 rows of data. I vaccumed the table: VACUUM ANALYZE ncccr10; SELECT count(*) FROM ncccr10; count 611564 (1 row) When I try to analyze the query plan with: EXPLAIN ANALYZE UPDATE ncccr10 SET key = facilityno||'-'|| las

Re: [SQL] Deleting rows in a file based on condition

2006-02-10 Thread Ken Hill
Oops. I posted this to the wrong support list. Sorry. -Ken On Fri, 2006-02-10 at 09:52 -0800, Ken Hill wrote: I have the following perl script that reads a fixed-width file and replaces values in various sections of the file. --- open

[SQL] Deleting rows in a file based on condition

2006-02-10 Thread Ken Hill
I have the following perl script that reads a fixed-width file and replaces values in various sections of the file. --- open (IN, '< in.txt'); open (OUT, '> out_test.txt'); while () {   chomp;   $first_section = substr $_, 0, 381;

Re: [SQL] query

2006-02-10 Thread Ken Hill
On Fri, 2006-02-10 at 00:11 -0600, Bruno Wolff III wrote: On Tue, Feb 07, 2006 at 01:45:50 -0800, "superboy143 (sent by Nabble.com)" <[EMAIL PROTECTED]> wrote: > > I have a table in which I have a field with format like 100101. It has many values like 100101, 100102, 100103, 100201, 100202

Re: [SQL] date

2006-02-10 Thread Ken Hill
On Fri, 2006-02-10 at 07:38 +0100, A. Kretschmer wrote: am 09.02.2006, um 22:18:09 -0800 mailte superboy143 (sent by Nabble.com) folgendes: > > Hello, > > How can I write an sql query in postgresql so that I can insert a date into > a table in the format DD-MM-, and when I select the d

Re: [SQL] unique constraint instead of primary key? what

2006-02-08 Thread Ken Hill
On Wed, 2006-02-08 at 21:04 -0500, george young wrote: [PostgreSQL 8.1.0 on i686-pc-linux-gnu, compiled by GCC gcc (GCC) 4.0.1] I'm designing a completely new schema for my database. A major criterion is that it facilitate ad-hoc queries via MS-access, excel and OpenOffice, presumably with O

Re: [SQL] Syntax for "IF" clause in SELECT

2006-02-08 Thread Ken Hill
This has been something I've been trying do so that I can do some column comparisons as part of "data-cleaning" work. I'll let you know if this helps me accomplish my task! On Wed, 2006-02-08 at 15:20 -0800, Bricklen Anderson wrote: [EMAIL PROTECTED] wrote: > Greetings, > > the following is

[SQL] Column Index vs Record Insert Trade-off?

2006-02-08 Thread Ken Hill
Is there a performance trade-off between column indexes and record inserts? I know that in MS Access there is such a trade-off. This being indexes make SQL queries perform faster at the cost of record insert speed. Put another way, the more column indexes in a table, the slower a record insert

Re: [SQL] Non Matching Records in Two Tables

2006-02-08 Thread Ken Hill
On Wed, 2006-02-08 at 16:27 -0500, Frank Bax wrote: At 04:10 PM 2/8/06, Ken Hill wrote: >I need some help with a bit of SQL. I have two tables. I want to find >records in one table that don't match records in another table based on a >common column in the two tables. Both

[SQL] Non Matching Records in Two Tables

2006-02-08 Thread Ken Hill
I need some help with a bit of SQL. I have two tables. I want to find records in one table that don't match records in another table based on a common column in the two tables. Both tables have a column named 'key100'. I was trying something like: SELECT count(*) FROM table1, table2 WHERE (tab