Re: using alias in where clause

2016-01-26 Thread Hal.sz S.ndor

2016/01/25 19:16 ... Larry Martell:

SELECT IFNULL(f_tag_bottom,
 IFNULL(f_tag_bottom_major_axis,
  IFNULL(f_tag_bottom_minor_axis,
   IFNULL(f_tag_ch_x_bottom,
IFNULL(f_tag_ch_y_bottom, NULL) as ftag,
STDDEV(ch_x_top)

Of course, this isn't your real problem, but you could use COALESCE 
instead of all those IFNULLs (and you don't need the last one):
	SELECT COALESCE(f_tag_bottom, f_tag_bottom_major_axis, 
f_tag_bottom_minor_axis, f_tag_ch_x_bottom, f_tag_ch_y_bottom) as ftag,

STDDEV(ch_x_top)


As Johnny Withers points out, you may repeat the expression in the 
WHERE-clause:
	WHERE COALESCE(f_tag_bottom, f_tag_bottom_major_axis, 
f_tag_bottom_minor_axis, f_tag_ch_x_bottom, f_tag_ch_y_bottom) = 'E-CD7'

If really only one of those is not NULL, it is equivalent to this:
	'E-CD7' IN (f_tag_bottom, f_tag_bottom_major_axis, 
f_tag_bottom_minor_axis, f_tag_ch_x_bottom, f_tag_ch_y_bottom)


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:http://lists.mysql.com/mysql



bytes in Recv-Q not processed by mysql

2016-01-26 Thread Jatin Davey

Hi All

In my application while writing to DB , i could see the following output 
from netstat for a single connection to the mysqld DB.


***
tcp   18  0 :::127.0.0.1:3306 :::127.0.0.1:43029  
ESTABLISHED 30850/mysqld keepalive (3517.74/0/0)


***

I could see that there are 18 outstanding bytes that are not read by 
mysql in this connection. This stays on indefinitely in my system and is 
cleared only until i restart my application. I could see some functional 
issues as well in my application and when i hit the functional issue i 
can see the above observation from the netstat -tonp command.


Basically certain threads get into BLOCKED state unable to write to DB. 
Any help / pointers would be really appreciated.


Thanks
Jatin