[前][次][番号順一覧][スレッド一覧]

mysql:16495

From: <mysql201706mailing@xxxxxxxxxx>
Date: Tue, 4 Dec 2018 23:48:53 +0900 (JST)
Subject: [mysql 16495] Re: [mysql 16487] Select文でのユーザ変数への代入機能が削除予定になった経緯

明智重蔵です。

削除予定になった経緯を探してみたら、
かなり近いものがMySQL開発者のブログにありました。
https://mysqlserverteam.com/row-numbering-ranking-how-to-use-less-user-variables-in-mysql-queries/

SELECT @rownum:=(@rownum+1) AS num, name, birthdate
FROM (SELECT @rownum:=0) AS initialization, people
ORDER BY birthdate;

It works. It relies on the fact that MySQL evaluates the content of the derived table named initialization.
But in the future, MySQL may become smarter and say that 
"this derived table isn't used by the statement so I can just skip its evaluation".
And it would thus skip the initialization.

将来のMySQLは、initializationという未使用なインラインビューの評価はスキップします。
という、興味深い記述もありますね。



添付ファイル

[前][次][番号順一覧][スレッド一覧]

   @ 16487 2018-10-26 23:11 [<mysql201706mailing@] Select文でのユーザ変数への代入機能が削除予定になった経緯
     16488 2018-10-27 00:11 ┣[とみたまさひろ <tomm]                                       
   @ 16489 2018-10-27 00:27 ┃┗[yoku0825 <yoku0825@x] Re: [mysql 16488] Re: Select文でのユーザ変数への代入機能が削除予定になった経緯
-> @ 16495 2018-12-04 23:48 ┗[<mysql201706mailing@] Re: [mysql 16487] Select文でのユーザ変数への代入機能が削除予定になった経緯