Re: [SQL] Insert multiple Rows

2003-03-04 Thread Oleg Samoylov
Hi, Saint X wrote: Hi, I have a program that need to send a Postgresql database a lot of rows, i'm doing it using FOR an INSERT, something like this for i = 0 to 1000 { insert into table(item1) VALUES (i); } And so on, as you can imagine these consume a lot of resources and move so slowly, that's

Re: [SQL] using Avg()

2003-03-04 Thread Christoph Haller
> > I have a table with a column named SwErr (Switch Error) with int values > date with datetime values and SwID with char(3) > I am trying to get a subset back where the folowing is true > > select the avg(SwErr) for the last 30 days where SwId = 'XX1' > Select the value of todays value of SwErr

Re: [SQL] Gist indexes on int arrays

2003-03-04 Thread Greg Stark
Greg Stark <[EMAIL PROTECTED]> writes: > Can I have a GiST index on (foo_id, attribute_set_array) and have it be just > as fast at narrowing the search to just foo_id = 900 but also speed up the ~ > operation? Hm, so if I understand what I'm reading I can do this if I load the btree_gist contrib

Re: [SQL] Forcing query to use an index

2003-03-04 Thread Jean-Luc Lachance
I beg to differ. A NULL field means not set. Having to use work around because the database does not index null is one thing, but making it a general rule is not. Having NULL indexed would also speed up things when "is null" is part af the query. Until then... JLL Greg Stark wrote: > > One

Re: [SQL] Insert multiple Rows

2003-03-04 Thread Gary Stainburn
On Tuesday 04 Mar 2003 10:54 am, Oleg Samoylov wrote: > Hi, > > Saint X wrote: > > Hi, I have a program that need to send a Postgresql database a lot of > > rows, i'm doing it using FOR an INSERT, something like this > > for i = 0 to 1000 > > { > > insert into table(item1) VALUES (i); > > } > > >

[SQL] SETOF

2003-03-04 Thread Fernando
Hi, I am using Postgresql version 7.2.2 I made a small function... CREATE FUNCTION ejem1(varchar) RETURNS SETOF to varchar as' SELECT names from mi_tabla WHERE city = $1; ' language ' SQL '; ejem1 Sergio Carlos Fernando When wanting to obtain several columns I do thi

Convert a text list to text array? Was: [SQL] Denormalizing duringselect

2003-03-04 Thread Guy Fraser
The email at the bottom gave me an idea, but it doesn't quite work: CREATE AGGREGATE accumulate( BASETYPE = text, SFUNC = textcat, STYPE = text, INITCOND = '' ); -- SELECT ('{' || ltrim(accumulate(',' || tablename),',') || '}') as cruft FROM pg_tables WHERE hasindexes = 'f';

Re: [SQL] LIMIT and SUBQUERIES

2003-03-04 Thread Tomasz Myrta
Chris wrote: Hi all, This question may be a bit confusing, and it is entirely possible that I am going about it the wrong way, but any suggestions would be much appreciated. I'm trying to query a table of records that has a (simplified) structure like the following: owner int description text amo