mysql:687
From: 奥田 典子 <奥田 典子 <okud_no@xxxxxxxxxx>>
Date: Sat, 13 Feb 1999 18:36:42 +0900
Subject: [mysql 00687] プレースホルダーを使った execute で Out of memory
はじめまして。奥田と申します。
先日は、<mysql-ctl> 宛てのコマンドをこちらにsendしてしまい、失礼致し
ました。
現在、PerlのDBIインタフェースを使用して、典型的なパターンのテストをし
ております。そこで、プレースホルダーを使ったSelect~executeを8000回近く
繰り返すと、Out of memory なるエラーでPerlスクリプトが挫折してしまう、
という現象に出くわしました。
テストしたスクリプトと、テーブル定義は、以下のとおりです。
$state = "SELECT USRYAK from USER where USUSER = ?";
$USERh = $dbh->prepare($state) || die $dbh->errstr;
for ($i = 0; $i <= 900000; $i++) {
$USERCD = sprintf("%08.8d", $i);
$USERh->execute('00003810') || die $USERh->errstr, "i=$i";
#1 $USERh->execute($USERCD) || die $USERh->errstr, "i=$i";
$USERh->bind_col(1, \$USRYAK);
while($USERh->fetchrow_arrayref()) {
print "USERCD=($USERCD) USRYAK=($USRYAK)\n";
}
}
注 #1: 最初、こちらの記述でテストしてエラーになりました。
executeの引数として使用した変数の設定に問題があるのかと思い、
定数にしてみたところ、同じ結果です。
Database: bics Table: USER Rows: 3482
+--------+-----------------+------+-----+------------+-------+
| Field | Type | Null | Key | Default | Extra |
+--------+-----------------+------+-----+------------+-------+
| USUSER | char(8) binary | | PRI | | |
| USRMEI | char(8) binary | | | | |
| USUSRM | char(40) binary | | | | |
| USRYAK | char(20) binary | | | | |
| USYUBN | char(6) binary | | | | |
| USTEL | char(12) binary | | | | |
| USJYU1 | char(24) binary | | | | |
| USJYU2 | char(24) binary | | | | |
| USBILL | char(24) binary | | | | |
| USTIKU | char(5) binary | | | | |
| USSTI | char(20) binary | | | | |
| USDMEI | char(16) binary | | | | |
| USTNTO | char(16) binary | | | | |
| USMNCD | char(5) binary | | | | |
| USGYOC | char(5) binary | | | | |
| USOSCD | char(5) binary | | | | |
| USSTNS | char(8) binary | | | | |
| USSTAN | char(6) binary | | | | |
| USETNK | char(3) binary | | | | |
| USETNB | char(6) binary | | | | |
| USETSM | char(32) binary | | | | |
| USETTM | char(16) binary | | | | |
| USFTNB | char(6) binary | | | | |
| USFTSM | char(32) binary | | | | |
| USFJTM | char(16) binary | | | | |
| USTRBI | date | | | 0000-00-00 | |
| USNEWH | date | | | 0000-00-00 | |
| USNEWS | char(6) binary | | | | |
| EXTUCD | char(8) binary | | | | |
| USHIND | char(1) binary | | | | |
| USKKCD | char(8) binary | | | | |
| USMNC2 | char(6) binary | | | | |
| USOLD | char(8) binary | | | | |
| USYB71 | char(3) binary | | | | |
| USYB72 | char(4) binary | | | | |
+--------+-----------------+------+-----+------------+-------+
エラーメッセージは、以下のとおりです。
Out of memory (Needed 8164 bytes)
MySQL client got out of memory at ./Fetch_DBI4.pl line 24.
MySQL client got out of memoryi=8002 at ./Fetch_DBI4.pl line 24.
(iの数は、実行の都度、微妙に変わりますが、8000前後です)
テスト環境は、以下のとおりです。
MySQL 3.21.30
DBI.pm v 1.86
プレースホルダーの使い方に何か問題があるでしょうか。
何か情報がありましたら教えていただきたいと思います。
よろしくお願いします。
-----------------------------------------------------------------
奥田 典子 <okud_no@xxxxxxxxxx>