Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

WwwxxXdbf, procmail "FROM_MAILER" patch, Use of assignment to $[ is deprecated at /usr/local/sbin/apxs line 86. , wwwxxx vim, mysql closing table and opening table, 800c5000, setgid operation not permitted, pciehp: acpi_pciehprm on IBM, WWWXXX.DBF, 078274121

Links

XODOX
Impressum

#1: optimizer in function

Posted on 2011-10-08 22:39:36 by (Halász Sándor) hsv

Does the optimizer look into function called from query?

In my queries the expression (SELECT hwyl FROM Stock) / (SELECT regularPayment FROM Stock), where Stock is a one-record table, often is repeated. The optimizer sees that, and makes the ratio a constant, and I can afford to be clear. If that expression were within a function called from the same spot, would the optimizer look into the function and see the same effectiv constant? or is it better to make it an argument to the function?


--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org

Report this message

#2: Re: optimizer in function

Posted on 2011-10-09 07:06:37 by Michael Dykman

--00151773ea2c92a0bd04aed6a374
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

I think the only clues the optimizer consults with regard to UDFs is the
'characteristic' provided at the time you create the routine.

from http://dev.mysql.com/doc/refman/5.0/en/create-procedure.html
*

*

*characteristic*:
COMMENT '*string*'
| LANGUAGE SQL
| [NOT] DETERMINISTIC
| { CONTAINS SQL | NO SQL | READS SQL DATA | MODIFIES SQL DATA }
| SQL SECURITY { DEFINER | INVOKER }


- michael dykman
2011/10/8 Hal=E1sz S=E1ndor <hsv@tbbs.net>

> Does the optimizer look into function called from query?
>
> In my queries the expression (SELECT hwyl FROM Stock) / (SELECT
> regularPayment FROM Stock), where Stock is a one-record table, often is
> repeated. The optimizer sees that, and makes the ratio a constant, and I =
can
> afford to be clear. If that expression were within a function called from
> the same spot, would the optimizer look into the function and see the sam=
e
> effectiv constant? or is it better to make it an argument to the function=
?
>
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dmdykman@gmail.com
>
>


--=20
- michael dykman
- mdykman@gmail.com

May the Source be with you.

--00151773ea2c92a0bd04aed6a374--

Report this message