Re: [SQL] Question on SQL and pg_-tables

2002-11-27 Thread Peter Childs
On Wednesday 27 November 2002 10:13, Tilo Schwarz wrote: > > Tilo Schwarz <[EMAIL PROTECTED]> writes: > > > - Is it possible to get not only the two tables, but also their > > > corresponding two columns involved in a RI-Constraint out of the pg_* > > > tables just with a SQL query? > > > > Not eas

Re: [SQL] join question

2002-11-27 Thread Nathan Young
OK, that works great, but I was told that I should avoid sub-selects when possible for performance reasons. Also, I used so much mental energy trying to find a solution that would do either task using a join that I would be very curious if anyone had a solution. The setup: >> I have a table wi

Re: [SQL] [GENERAL] FreeBSD, Linux: select, select count(*) performance

2002-11-27 Thread Tom Lane
Achilleus Mantzios <[EMAIL PROTECTED]> writes: > On Wed, 27 Nov 2002, Tom Lane wrote: >> You didn't say what was *in* the table, exactly ... but I'm betting >> there are a lot of toasted columns, and that the extra runtime >> represents the time to fetch (and perhaps decompress) the TOAST entries.

Re: [SQL] [GENERAL] FreeBSD, Linux: select, select count(*) performance

2002-11-27 Thread Achilleus Mantzios
On Wed, 27 Nov 2002, Tom Lane wrote: > Achilleus Mantzios <[EMAIL PROTECTED]> writes: > > Linux q1 > > > > dynacom=# EXPLAIN ANALYZE SELECT count(*) from noon; > > NOTICE: QUERY PLAN: > > > Aggregate (cost=20508.19..20508.19 rows=1 width=0) (actual > > time=338.17..338.17 > > rows=1 loo

Re: [SQL] [GENERAL] FreeBSD, Linux: select, select count(*) performance

2002-11-27 Thread Tom Lane
Achilleus Mantzios <[EMAIL PROTECTED]> writes: > Linux q1 > > dynacom=# EXPLAIN ANALYZE SELECT count(*) from noon; > NOTICE: QUERY PLAN: > Aggregate (cost=20508.19..20508.19 rows=1 width=0) (actual > time=338.17..338.17 > rows=1 loops=1) > -> Seq Scan on noon (cost=0.00..20237.95 ro

Re: [SQL] Function and insert

2002-11-27 Thread Richard Huxton
On Wednesday 27 Nov 2002 11:05 am, Laurent Patureau wrote: > Hi, > > I want to do a function that insert a row on a table like : > > CREATE FUNCTION ajout_secu(INT4) RETURNS OID > AS 'INSERT INTO test_2 VALUES($1);' > LANGUAGE 'SQL'; > > PG refuse to accept the type returns oid as the fun

Re: [SQL] Casting Money To Numeric

2002-11-27 Thread D'Arcy J.M. Cain
On November 26, 2002 02:19 pm, Thomas Good wrote: > Having perused all the online docs I can find it appears there is no > SQL solution for casting the dread money type to numeric. > Is this true? > > select rent::numeric(9,2) from x; > ERROR: Cannot cast type 'money' to 'numeric' Fraid so. That'

[SQL] Big query problem

2002-11-27 Thread Tomas Berndtsson
I'm using 7.2.1, trying to run a query like this: DELETE FROM table WHERE col1='something' AND col2 IN ('aasdoijhfoisdfsdoif','sdfsdfsdfsadfsdf', ... ); In the parantheses I have 6400 names, each about 20 characters. I'm using libpq from C. This did not work very well, but the result was very une

[SQL] FreeBSD, Linux: select, select count(*) performance

2002-11-27 Thread Achilleus Mantzios
Hi, i run 2 queries on 2 similar boxes (one running Linux 2.4.7, redhat 7.1 and the other running FreeBSD 4.7-RELEASE-p2) The 2 boxes run postgresql 7.2.3. I get some performance results that are not obvious (at least to me) i have one table named "noon" with 108095 rows. The 2 queries are: q

[SQL] Function and insert

2002-11-27 Thread Laurent Patureau
Hi, I want to do a function that insert a row on a table like : CREATE FUNCTION ajout_secu(INT4) RETURNS OID AS 'INSERT INTO test_2 VALUES($1);' LANGUAGE 'SQL'; PG refuse to accept the type returns oid as the function is not a SELECT. What can I do ? thanks for your help, LP --

Re: [SQL] Question on SQL and pg_-tables

2002-11-27 Thread Tilo Schwarz
> Tilo Schwarz <[EMAIL PROTECTED]> writes: > > - Is it possible to get not only the two tables, but also their > > corresponding two columns involved in a RI-Constraint out of the pg_* > > tables just with a SQL query? > > Not easily --- the column info is buried in the pg_trigger.tgargs entries >

Re: [SQL] SQL query help!

2002-11-27 Thread Luis Sousa
Tell me what did you try with limit and group by. Where's IN, why don't you use EXISTS instead. It runs much master ! Regards, Luis Sousa Arcadius A. wrote: Hello! I hope that someone here could help. I'm using PostgreSQL7.1.3 I have 3 tables in my DB: the tables are defined in the following