Re: [SQL] OR clause causing strange index performance

2004-05-20 Thread Tom Lane
Doug Y <[EMAIL PROTECTED]> writes: > Is there any way to get this query to use the correct index condition so > that it runs in a reasonable amount of time? I think CVS tip (7.5-to-be) would handle this better, but it's hard to be sure since you didn't provide a self-contained test case.

Re: [SQL] Simple view confuses PostgreSQL query planning

2004-05-20 Thread Manuel Sugawara
Tom Lane <[EMAIL PROTECTED]> writes: > Get rid of the CASEs (perhaps you could wrap them into functions > declared STRICT) and the view would be flattenable. Will do that. Thanks. Regards, Manuel. ---(end of broadcast)--- TIP 3: if posting/reading

Re: [SQL] Simple view confuses PostgreSQL query planning

2004-05-20 Thread Tom Lane
Manuel Sugawara <[EMAIL PROTECTED]> writes: > I'm facing a wired problem. When I left join two tables PostgreSQL is > able to do it fast using the corresponding indices, However, if I > define a simple view (to format the data) on one of the tables, the > left join does not use the indices. Is some

[SQL] v7.2 triggers and foreign keys

2004-05-20 Thread Paul Gimpelj
Hi,   I have two tables a and b.; b references a. I used pgaccess to create tables. and psql to create the triggers and foreign keys. a has sequential id, and primary key same column.   As constraints they were implicit, and cascade was off.   On delete of the of a b row, postgres also delete

Re: [SQL] OR clause causing strange index performance

2004-05-20 Thread Doug Y
Sorry, I just realized that my logic for the query is flawed anyway. It won't return the proper data set I'm after. I'll have to go back to looking at the lists table first. I still guess knowing why the query below isn't as quick as expected could be useful though. At 01:32 PM 5/20/2004,

[SQL] Simple view confuses PostgreSQL query planning

2004-05-20 Thread Manuel Sugawara
[I sent this message two months ago and got no answer. I'm resending now hoping to get some feedback.] Hi, I'm facing a wired problem. When I left join two tables PostgreSQL is able to do it fast using the corresponding indices, However, if I define a simple view (to format the data) on one of th

[SQL] OR clause causing strange index performance

2004-05-20 Thread Doug Y
Hello, For the following query: SELECT * FROM permissions p INNER JOIN users u ON u.id = p.id LEFT JOIN user_list ul1 ON ul1.id = u.id AND ul1.type = '1' LEFT JOIN user_list ul2 ON ul2.id = u.id AN

Re: [SQL] Replace function ...

2004-05-20 Thread Benoît BOURNON
I try to reencode postgresql db ... all is running ... in your shell : - pg_dump db  -f fileout - iconv fileout i do not remember parameters but iconv converts the file. - createdb db -U unicode (for example) - pgsql db < fileout_converted We change previous year the encoding of this webs

Re: [SQL] where to start with this procedure ?

2004-05-20 Thread Stephan Szabo
On Thu, 20 May 2004, Andreas wrote: > > Hi Andrei, > > > >Use the Offset and Limit in the SQL query. > >[...] > >SELECT select_list > >FROM table_expression > >WHERE condition > >LIMIT 50 > >OFFSET 1 > > > >This query will return 50 elements starting with the 1 elements...

Re: [SQL] where to start with this procedure ?

2004-05-20 Thread Andreas
Hi Andrei, Use the Offset and Limit in the SQL query. [...] SELECT select_list FROM table_expression WHERE condition LIMIT 50 OFFSET 1 This query will return 50 elements starting with the 1 elements... so the elemenst from 1 to 10050. That isn't the issue since I only ne

Re: [SQL] where to start with this procedure ?

2004-05-20 Thread Andrei Bintintan
Hi, Use the Offset and Limit in the SQL query. http://developer.postgresql.org/docs/postgres/queries-limit.html For example: SELECT select_list FROM table_expression WHERE condition Let's supose that this query returnes normaly 3 elements. SELECT select_list FROM table_expressi