Re: [PERFORM] Bad query plan when the wrong data type is used

2012-09-01 Thread Bruce Momjian
On Mon, Feb 28, 2011 at 02:04:53PM -0500, Robert Haas wrote: On Sun, Feb 27, 2011 at 1:39 PM, Tom Lane t...@sss.pgh.pa.us wrote: Robert Haas robertmh...@gmail.com writes: On Tue, Feb 8, 2011 at 5:04 PM, Josh Berkus j...@agliodbs.com wrote: I'm not saying that PostgreSQL couldn't do better

Re: [PERFORM] Bad query plan when the wrong data type is used

2011-02-28 Thread Robert Haas
On Sun, Feb 27, 2011 at 1:39 PM, Tom Lane t...@sss.pgh.pa.us wrote: Robert Haas robertmh...@gmail.com writes: On Tue, Feb 8, 2011 at 5:04 PM, Josh Berkus j...@agliodbs.com wrote: I'm not saying that PostgreSQL couldn't do better on this kind of case, but that doing better is a major project,

Re: [PERFORM] Bad query plan when the wrong data type is used

2011-02-27 Thread Robert Haas
On Tue, Feb 8, 2011 at 5:04 PM, Josh Berkus j...@agliodbs.com wrote: Laszlo, Which is silly. I think that PostgreSQL converts the int side to a float, and then compares them. It would be better to do this, for each item in the loop:     * evaluate the right side (which is float)     *

Re: [PERFORM] Bad query plan when the wrong data type is used

2011-02-27 Thread Tom Lane
Robert Haas robertmh...@gmail.com writes: On Tue, Feb 8, 2011 at 5:04 PM, Josh Berkus j...@agliodbs.com wrote: I'm not saying that PostgreSQL couldn't do better on this kind of case, but that doing better is a major project, not a minor one. Specifically, the problem is that x = 4.0, where x

Re: [PERFORM] Bad query plan when the wrong data type is used

2011-02-09 Thread Vitalii Tymchyshyn
09.02.11 01:14, Dave Crooke написав(ла): You will get the same behaviour from any database product where the query as written requires type coercion - the coercion has to go in the direction of the wider type. I have seen the exact same scenario with Oracle, and I view it as a problem with the

[PERFORM] Bad query plan when the wrong data type is used

2011-02-08 Thread Laszlo Nagy
This query: select p.id,p.producer_id,visa.variation_item_id, vi.qtyavail from variation_item_sellingsite_asin visa inner join product p on p.id = visa.product_id inner join variation_item vi on vi.id =

Re: [PERFORM] Bad query plan when the wrong data type is used

2011-02-08 Thread Josh Berkus
Laszlo, Which is silly. I think that PostgreSQL converts the int side to a float, and then compares them. It would be better to do this, for each item in the loop: * evaluate the right side (which is float) * tell if it is an integer or not * if not an integer, then discard

Re: [PERFORM] Bad query plan when the wrong data type is used

2011-02-08 Thread Dave Crooke
You will get the same behaviour from any database product where the query as written requires type coercion - the coercion has to go in the direction of the wider type. I have seen the exact same scenario with Oracle, and I view it as a problem with the way the query is written, not with the