Re: [PERFORM] Optimising queries involving unions

2005-05-27 Thread Marc Mamin
Hi, I'm using a workaround for this kind of issues: consider: select A from (select B from T1 where C union select B from T2 where C union select B from T3 where C ) foo where D in your

[PERFORM] Optimising queries involving unions

2005-05-26 Thread Sam Mason
Hi, I've got a query that I think the query optimiser should be able to work it's magic on but it doesn't! I've had a look around and asked on the IRC channel and found that the current code doesn't attempt to optimise for what I'm asking it to do at the moment. Here's a bad example: SELECT

Re: [PERFORM] Optimising queries involving unions

2005-05-26 Thread Tom Lane
Sam Mason [EMAIL PROTECTED] writes: Here's a bad example: SELECT u.txt FROM smalltable t, ( SELECT id, txt FROM largetable1 UNION ALL SELECT id, txt FROM largetable2) u WHERE t.id = u.id AND t.foo = 'bar'; I was hoping that smalltable would get moved up into the

Re: [PERFORM] Optimising queries involving unions

2005-05-26 Thread Sam Mason
Tom Lane wrote: It'd be nice to fix this someday, but don't hold your breath ... Thanks for the response! Is it even worth me thinking about trying to figure out how to make the current code do this sort of thing? or is it just not going to happen with the code as it is? Sam

Re: [PERFORM] Optimising queries involving unions

2005-05-26 Thread Tom Lane
Sam Mason [EMAIL PROTECTED] writes: Tom Lane wrote: It'd be nice to fix this someday, but don't hold your breath ... Is it even worth me thinking about trying to figure out how to make the current code do this sort of thing? Probably not :-(. What we need is to integrate UNION (and the