Re: [SQL] huge disparities in =/IN/BETWEEN performance

2007-02-08 Thread Joe
Hi Tom, On Thu, 2007-02-08 at 23:24 -0500, Tom Lane wrote: > Certainly, but your other concerns don't follow from that. The issue at > hand here is whether it's worth expending cycles on every query to try > to detect a situation that only holds for a few. Those where George's concerns, but I wa

[SQL] unsubscribe

2007-02-08 Thread Arulmani V A
unsubscribe We won't tell. Get more on shows you hate to love (and love to hate): Yahoo! TV's Guilty Pleasures list. http://tv.yahoo.com/collections/265 ---(end of broadcast)-

Re: [SQL] huge disparities in =/IN/BETWEEN performance

2007-02-08 Thread Tom Lane
Joe <[EMAIL PROTECTED]> writes: > Are you saying the planner is datatype-agnostic Certainly, but your other concerns don't follow from that. The issue at hand here is whether it's worth expending cycles on every query to try to detect a situation that only holds for a few.

Re: [SQL] huge disparities in =/IN/BETWEEN performance

2007-02-08 Thread Joe
Hi Tom, On Thu, 2007-02-08 at 22:50 -0500, Tom Lane wrote: > There's a datatype abstraction issue involved: what does it take to > prove that "x >= 10 AND x <= 10" is equivalent to "x = 10"? This > requires a nontrivial amount of knowledge about the operators involved. > We could probably do it f

Re: [SQL] huge disparities in =/IN/BETWEEN performance

2007-02-08 Thread Tom Lane
Alvaro Herrera <[EMAIL PROTECTED]> writes: > I think the principle here is that the system is not gonna waste cycles > on dumb queries. Supposedly, morphing "foo BETWEEN 10 and 10" into > "foo=10" is not a trivial transformation, and it'd impose a planning > cost on all non-dumb BETWEEN queries.

Re: [SQL] huge disparities in =/IN/BETWEEN performance

2007-02-08 Thread Alvaro Herrera
George Pavlov wrote: > the basic question i have is fairly clear though: why saying "where x = > 10" should be different (in ANY cicumstance, not just mine) from saying > "where x between 10 and 10" or from "where x in (select ... /* some > query that returns 10 */)" ??? I think the principle h

Re: [SQL] huge disparities in =/IN/BETWEEN performance

2007-02-08 Thread George Pavlov
> > BYs on user_id and various subqueries, but my basic thought is that > > should not really matter... > > You're unlikely to get any useful comment on this when you have not > shown any of those details, nor even an EXPLAIN. yes, i know. i guess i was partially just venting. sorry. the problem

Re: [SQL] huge disparities in =/IN/BETWEEN performance

2007-02-08 Thread Tom Lane
"George Pavlov" <[EMAIL PROTECTED]> writes: > there is, admittedly, substantial complexity inside v_foo, with GROUP > BYs on user_id and various subqueries, but my basic thought is that > should not really matter... You're unlikely to get any useful comment on this when you have not shown any of t

Re: [SQL] Seeking quick way to clone a row, but give it a new pk.

2007-02-08 Thread John DeSoi
A pl/pgsql function can do this easily. Something like this (not tested): create or replace function dup_my_table(old_key text, new_key text) returns text as $$ declare rec my_table; begin; select into rec * from my_table where key_field = old_key; rec.key_field = new

[SQL] huge disparities in =/IN/BETWEEN performance

2007-02-08 Thread George Pavlov
all my SQL-writin' life i have been assuming that expressions like =, IN, BETWEEN in the WHERE clause are, in the most general sense, alternative ways of doing the same things. i am hitting some very very bizarre results in PGSQL: i have a (very involved) view, say v_foo, largely optimized to be q

Re: [SQL] metaphone and nysiis in postgres

2007-02-08 Thread Jan Muszynski
On 8 Feb 2007 at 10:59, Demel, Jeff wrote: > I don't have a problem with doing this in our development environment, > but when we go to move it onto the live production box, with all the > live data and current custom settings, will a re-install cause issues? > Data loss is unacceptable, of course

Re: [SQL] COPY FROM - force a value

2007-02-08 Thread Demel, Jeff
That works like a charm. Thanks, Alvaro! -Jeff -Original Message- From: Alvaro Herrera [mailto:[EMAIL PROTECTED] Sent: Thursday, February 08, 2007 1:22 PM To: Demel, Jeff Cc: pgsql-sql@postgresql.org Subject: Re: [SQL] COPY FROM - force a value Demel, Jeff wrote: > Is there a way to f

Re: [SQL] Differentiate Between Zero-Length String and NULLColumn Values

2007-02-08 Thread Jan Wieck
On 1/30/2007 3:17 PM, Jamie A Lawrence wrote: Just a datapoint: SQL*Plus: Release 10.1.0.3.0 - Production on Tue Jan 30 15:15:49 2007 Copyright (c) 1982, 2004, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production With the Partition

Re: [SQL] COPY FROM - force a value

2007-02-08 Thread Alvaro Herrera
Demel, Jeff wrote: > Is there a way to force a value when you're doing a COPY FROM, importing > a file into a table? > > Here's my query as it is now: > > COPY filetable (value1, value2, value3, value4, forcevalue1, > forcevalue2) > FROM 'C:\\InsertFiles\\thisfile.txt' > WITH DELIMITER AS ' '

[SQL] unsubscribe

2007-02-08 Thread David Klugmann
unsubscribe ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly

[SQL] COPY FROM - force a value

2007-02-08 Thread Demel, Jeff
Is there a way to force a value when you're doing a COPY FROM, importing a file into a table? Here's my query as it is now: COPY filetable (value1, value2, value3, value4, forcevalue1, forcevalue2) FROM 'C:\\InsertFiles\\thisfile.txt' WITH DELIMITER AS ' ' ; The file only contains data for

Re: [SQL] Open a Transaction

2007-02-08 Thread Ezequias Rodrigues da Rocha
I increase the "max_stack_depth" and the In statemen run OK. I don't know if it is good to put this variable as big as possible or as the manual report (using ulimit -s) to put the larger stack capacity of Operational System. Ezequias 2007/2/8, Andrew Sullivan <[EMAIL PROTECTED]>: On Thu, Feb

Re: [SQL] Open a Transaction

2007-02-08 Thread Tom Lane
"Ezequias Rodrigues da Rocha" <[EMAIL PROTECTED]> writes: > Now the sql is OK but now I have the following error: > ERROR: stack depth limit exceeded > SQL state: 54001 > Hint: Increase the configuration parameter "max_stack_depth". > In the previous e-mail I hide the numbers of itens of my set >

Re: [SQL] Open a Transaction

2007-02-08 Thread Andrew Sullivan
On Thu, Feb 08, 2007 at 03:13:16PM -0200, Ezequias Rodrigues da Rocha wrote: > > Any suggestion instead of change my max_stack_depth ? Well, I suppose you could put the numbers in a temp table an NOT IN on that. A -- Andrew Sullivan | [EMAIL PROTECTED] The fact that technology doesn't work is

Re: [SQL] Open a Transaction

2007-02-08 Thread Roberto Fichera
At 17.50 08/02/2007, Ezequias Rodrigues da Rocha wrote: >Hi list, > >Could someone tell me what is wrong on this statement ? > >Start Transaction >delete from base.something >where >id in( >41503, >41504, >41505, >41506, >41507, >41508, >41509, >41510, >41511, >41512, >41513, >41514, >41515, >41516

Re: [SQL] Open a Transaction

2007-02-08 Thread Ezequias Rodrigues da Rocha
Now the sql is OK but now I have the following error: ERROR: stack depth limit exceeded SQL state: 54001 Hint: Increase the configuration parameter "max_stack_depth". In the previous e-mail I hide the numbers of itens of my set (in(234,12332,1232,) actually I have more than 36000 subsets of

Re: [SQL] metaphone and nysiis in postgres

2007-02-08 Thread Demel, Jeff
I don't have a problem with doing this in our development environment, but when we go to move it onto the live production box, with all the live data and current custom settings, will a re-install cause issues? Data loss is unacceptable, of course, but it would also be nice if we don't have to jugg

Re: [SQL] Open a Transaction

2007-02-08 Thread Joe
Hi Ezequias, On Thu, 2007-02-08 at 14:50 -0200, Ezequias Rodrigues da Rocha wrote: > Hi list, > > Could someone tell me what is wrong on this statement ? > > Start Transaction The above should read begin; > delete from base.something > where > id in( > 41503, > 41504, > 41505, > 41506, > 415

[SQL] Open a Transaction

2007-02-08 Thread Ezequias Rodrigues da Rocha
Hi list, Could someone tell me what is wrong on this statement ? Start Transaction delete from base.something where id in( 41503, 41504, 41505, 41506, 41507, 41508, 41509, 41510, 41511, 41512, 41513, 41514, 41515, 41516, 41517, 41518, 41519, 41520, 41521, 41522, 41523, 41524, 41525, 41526, 41527

Re: [SQL] Seeking quick way to clone a row, but give it a new pk.

2007-02-08 Thread Greg Sabino Mullane
-BEGIN PGP SIGNED MESSAGE- Hash: RIPEMD160 > I need to create some nearly identical copies of rows in > a complicated table. > > Is there a handy syntax that would let me copy a existing row, > but get a new primary key for the copy? http://people.planetpostgresql.org/greg/index.php?/ar

Re: [SQL] Odd PL/PgSQL Error -- relation "X" does not exist when using index expression

2007-02-08 Thread Tom Lane
Michael Fuhr <[EMAIL PROTECTED]> writes: > On Thu, Feb 08, 2007 at 10:32:25AM -0500, Tom Lane wrote: >> My advice is not to try to execute multiple commands in the same EXECUTE >> string --- if we were going to do anything to "fix" this, I think it >> would be along the lines of enforcing that advi

Re: [SQL] Odd PL/PgSQL Error -- relation "X" does not exist when using index expression

2007-02-08 Thread Michael Fuhr
On Thu, Feb 08, 2007 at 10:32:25AM -0500, Tom Lane wrote: > My advice is not to try to execute multiple commands in the same EXECUTE > string --- if we were going to do anything to "fix" this, I think it > would be along the lines of enforcing that advice. Trying to make the > world safe for it do

Re: [SQL] Odd PL/PgSQL Error -- relation "X" does not exist when using index expression

2007-02-08 Thread Tom Lane
Michael Fuhr <[EMAIL PROTECTED]> writes: > Using separate calls to SPI_exec() works. Using a single call to > SPI_exec() works if the index is on (t) instead of (lower(t)): > SPI_exec("CREATE TABLE foo (t text); CREATE INDEX foo_idx ON foo (t)", 0); It's only by chance that it works in that case

[SQL] unsubscribe

2007-02-08 Thread Adrien Lebre
unsubscribe -- Adrien LEBRE Projet PARIS / XtreemOS IRISA, Rennes, France +33(0)2 99 84 22 39 http://www.xtreemos.org ---(end of broadcast)--- TIP 9: In versions below 8.0

[SQL] unsubscribe

2007-02-08 Thread Wilkinson, Jim
unsubscribe

Re: [SQL] Odd PL/PgSQL Error -- relation "X" does not exist when using index expression

2007-02-08 Thread Michael Fuhr
On Thu, Feb 08, 2007 at 11:14:33AM -0300, Alvaro Herrera wrote: > Michael Fuhr wrote: > > The error appears to happen for anything that uses SPI. A C function > > that executes the following fails with the same error: > > > > SPI_exec("CREATE TABLE foo (t text); CREATE INDEX foo_idx ON foo > > (

Re: [SQL] Odd PL/PgSQL Error -- relation "X" does not exist when using index expression

2007-02-08 Thread Alvaro Herrera
Michael Fuhr wrote: > On Wed, Feb 07, 2007 at 02:43:13PM -0800, Greg Wittel wrote: > > I'm having a strange problem with a PL/PGSQL query that executes some > > dynamic SQL code. The code basically creates a dynamically named table, > > some indexes, etc. > > > > The problem seems to be the an

[SQL] unsubscribe

2007-02-08 Thread Susan Evans
Unsubscribe Susan Evans Haywood County Schools NCWISE Coordinator 216 Charles Street Clyde, NC 28721 828-627-8314 (Phone) 828-627-8277 (Fax) 216 Charles Street Clyde, NC 28721 ---(end of broadcast)--- TIP 6: explain analyze is your friend

[SQL] unsubscribe

2007-02-08 Thread oliverp21
unsubscribe ---(end of broadcast)--- TIP 1: if posting/reading through Usenet, please send an appropriate subscribe-nomail command to [EMAIL PROTECTED] so that your message can get through to the mailing list cleanly

Re: [SQL] Odd PL/PgSQL Error -- relation "X" does not exist when using index expression

2007-02-08 Thread Michael Fuhr
On Wed, Feb 07, 2007 at 02:43:13PM -0800, Greg Wittel wrote: > I'm having a strange problem with a PL/PGSQL query that executes some > dynamic SQL code. The code basically creates a dynamically named table, > some indexes, etc. > > The problem seems to be the an index expression. If I remove it

Re: [SQL] interval as hours or minutes ?

2007-02-08 Thread Aarni Ruuhimäki
Ahh, Forgot about trunc() in the midst of all this ... Thank you guys again ! Aarni On Thursday 08 February 2007 12:06, Bart Degryse wrote: > Use trunc instead of round. > Also take a look at ceil and floor functions > > >>> Aarni Ruuhimäki <[EMAIL PROTECTED]> 2007-02-08 11:01 >>> > > On Thursd

Re: [SQL] interval as hours or minutes ?

2007-02-08 Thread Bart Degryse
Use trunc instead of round. Also take a look at ceil and floor functions >>> Aarni Ruuhimäki <[EMAIL PROTECTED]> 2007-02-08 11:01 >>> On Thursday 08 February 2007 00:09, you wrote: > select extract(epoch from (timestamp '2007-02-07 16:24:00' - timestamp > '2007-02-05 13:00:01'))/60 as minutes; > >

Re: [SQL] interval as hours or minutes ?

2007-02-08 Thread Aarni Ruuhimäki
On Thursday 08 February 2007 00:09, you wrote: > select extract(epoch from (timestamp '2007-02-07 16:24:00' - timestamp > '2007-02-05 13:00:01'))/60 as minutes; > >      minutes > -- >  3083.983 > (1 row) > > select round(extract(epoch from (timestamp '2007-02-07 16:24:00' -

Re: [SQL] Seeking quick way to clone a row, but give it a new pk.

2007-02-08 Thread Aarni Ruuhimäki
On Thursday 08 February 2007 09:19, Bryce Nesbitt wrote: > > > > INSERT INTO mytable SELECT * FROM mytable WHERE pk = 123; > > > > Or something close to that... I suspect if you changed the '*' to the > > columns you wanted you could also work in the other columns you want > > to change as well...

Re: [SQL] metaphone and nysiis in postgres

2007-02-08 Thread Richard Huxton
Demel, Jeff wrote: Can this be installed easily on Windows? Try re-running the installer, it should let you tick various options to install from contrib. -- Richard Huxton Archonet Ltd ---(end of broadcast)--- TIP 5: don't forget to increa