Re: Making Myself Crazy

2012-09-19 Thread Jan Steinman
Thanks for your help, Rick! Interspersed are some questions and rationales for you to shoot down... :-) > From: Rick James > > s_product_sales_log has no PRIMARY KEY. All InnoDB tables 'should' have an > explicit PK. This table really has no identifying information. There could be two identi

Re: getting certain rows from a group by

2012-09-19 Thread hsv
2012/09/19 14:36 -0400, Larry Martell MIN(ABS(Avg(bottom) - bottom)) Is not valid. It gives: ERROR (HY000): Invalid use of group function Yes, I had my doubts of that, for all that I suggested it. -- MySQL General Mailing List For list archives: http://lists.mysql.com/m

RE: getting certain rows from a group by

2012-09-19 Thread Rick James
> my counts are 3 times too much. Without studying the code, I would guess that there is a JOIN between he data that needs COUNTing and the GROUP BY for the COUNT. That is, it collects more 'joined' rows before counting. Fixing it will probably make the query even messier. > -Original Mes

Re: getting certain rows from a group by

2012-09-19 Thread Larry Martell
Well, I'm getting the proper rows from the 4 joins I added, but now I'm seeing a weird side effect - my counts are 3 times to much. The query is really huge and nasty now, but I'm going to paste it below. In the outer most select, Wafers, Rerun, Runs, and Count are 3 times what they should be. If

RE: Making myself crazy...

2012-09-19 Thread Rick James
Other comments: s_product_sales_log has no PRIMARY KEY. All InnoDB tables 'should' have an explicit PK. INT(5) is not what you think. INT is always a 32-bit, 4-byte quantity, regardless of the number. Use TINYINT UNSIGNED, SMALLINT UNSIGNED, etc. wherever reasonable. > KEY `is_value_added`

RE: InnoDB vs. other storage engines

2012-09-19 Thread Rick James
No flames from me; I stay out of that religious war. However, the general consensus is to move to InnoDB. So, here are the gotchas. Most are non-issues; a few might bite you, but can probably be dealt with: http://mysql.rjweb.org/doc.php/myisam2innodb > -Original Message- > From: M

Re: InnoDB vs. other storage engines

2012-09-19 Thread Manuel Arostegui
2012/9/19 Mark Haney > I hope this doesn't end in some kind of flame war. I'm looking to > optimize my tables (and performance in general) of the DB my web app is > using. I'm tweaking things a little at a time, but I'm curious as to what > the rest of the MySQL list thinks about changing my st

Re: getting certain rows from a group by

2012-09-19 Thread Larry Martell
OK, I think I have this working. The last join was this: JOIN (select id, target_name_id, ep,date_time from data_cst WHERE target_name_id IN (775, 776, 777, 778, 779, 780, 45, 44, 116, 117, 118, 119, 120, 121) AND data_cst.date_time BETWEEN '2010-03-04 00:00:00' AND '2010-03-04 23:59:59' GROUP BY

Re: getting certain rows from a group by

2012-09-19 Thread Larry Martell
On Wed, Sep 19, 2012 at 10:26 AM, Larry Martell wrote: > On Wed, Sep 19, 2012 at 12:04 AM, wrote: >> 2012/09/18 06:53 -0400, Larry Martell >> This works fine. But now I need to get a certain column >> (image_measurer_id) with each row returned that corresponds to the row >> from the gro

Re: getting certain rows from a group by

2012-09-19 Thread Larry Martell
On Wed, Sep 19, 2012 at 12:04 AM, wrote: > 2012/09/18 06:53 -0400, Larry Martell > This works fine. But now I need to get a certain column > (image_measurer_id) with each row returned that corresponds to the row > from the group that has bottom = Min(bottom), bottom = Max(bottom), > bott

InnoDB vs. other storage engines

2012-09-19 Thread Mark Haney
I hope this doesn't end in some kind of flame war. I'm looking to optimize my tables (and performance in general) of the DB my web app is using. I'm tweaking things a little at a time, but I'm curious as to what the rest of the MySQL list thinks about changing my storage engine from InnoDB to

Re: getting certain rows from a group by

2012-09-19 Thread Larry Martell
On Wed, Sep 19, 2012 at 12:04 AM, wrote: > 2012/09/18 06:53 -0400, Larry Martell > This works fine. But now I need to get a certain column > (image_measurer_id) with each row returned that corresponds to the row > from the group that has bottom = Min(bottom), bottom = Max(bottom), > bott

Re: getting certain rows from a group by

2012-09-19 Thread Larry Martell
On Tue, Sep 18, 2012 at 7:41 PM, Rick James wrote: > SELECT ((the appropriate id)) -- <-- > FROM data_cst, rollup, data_target > WHERE data_target.name = rollup.Target > AND data_cst.ep = rollup.EP > AND data_cst.date_time BETWEEN '2010-03-04 00:00:00' AND '2010-0