-
Notifications
You must be signed in to change notification settings - Fork 34
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
max_prepared_stmt_count #38
Comments
there is currently no implementation for 'delete statement' command. Statements are freed on reconnect. You could try to implement it yourself (it's relatively easy to add new commands and command itself is simple - send 'delete' code and two-bytes handle) or wait for me implementing it. Feel free to ask for help if you decide to do it yourself |
or i terminate the connection and create a new client?! is that possible?! |
yes, when connection is closed server frees all statements allocated for this connection could you explain your case? do you have lots of short-lived statements? The reason for still not implementing 'destroy statement' command is that I usually have two type of queries: 1) no parameters, on-time query 2) input data, used through appication lifetime. for 1) i use .query(), for 2) - execute() Said that, I'm happy to implement 'destroyStatement' command at some time |
my use case is currently import 1Mio+ user data into a redis database... |
statements are prepared on first execution and cached (e.i there should be no more prepared statements than types of query, not number of rows) Could you show your code? |
I created separate issue - #39 |
/**
* Created by JetBrains PhpStorm.
* User: francis
* Date: 7/12/11
* Time: 10:33 PM
* To change this template use File | Settings | File Templates.
*/
var redisClient;
var redisModule;
var mysqlDBClient;
var currentRow = 0;
var sys;
var mysqlDBName = "myDB";
var mysqlDBUser = "root";
var mysqlDBPW = "root";
var currentTable = "users";
function init() {
sys = require('sys');
mysqlDBClient = getDBClient();
redisModule = require('redis-node');
redisClient = redisModule.createClient();
redisClient.select("crowdpark_users");
sys.log("START");
redisClient.flushdb(fetchMySQLData);
}
function fetchMySQLData() {
var sqlStmt = "select * from " + currentTable + " limit " + currentRow + ", 1;";
currentRow++;
//doesnt catch the error in mysql-native
try {
mysqlDBClient = getDBClient();
mysqlDBClient.execute(sqlStmt).addListener("row", onUsersDataFetched);
} catch(error) {
sys.log(currentRow);
sys.log("END");
}
}
function getDBClient() {
var client = require("mysql-native").createTCPClient(); // localhost:3306 by default
client.auto_prepare = true;
client.auth(mysqlDBName, mysqlDBUser, mysqlDBPW);
return client;
}
function onUsersDataFetched(rows) {
var id = rows.id;
delete rows.id;
if (!rows) {
sys.log("END");
exit;
}
var jsonString = JSON.stringify(rows);
redisClient.set(id, jsonString, function (err, status) {
if (err) {
throw err;
} else {
delete rows;
mysqlDBClient.close();
mysqlDBClient.terminate();
delete mysqlDBClient;
fetchMySQLData();
}
});
}
init();
|
on my opinion there are lots things you doing wrong
currentTable and currentRow are obvious parameters here.
this is the source of original problem: yes, you trying to have LOTS of prepared statemts while you really need only one
|
Hi, thx for your time... i solve many problems with your tips and infos... thx a lot... |
how i can remove statements? i write currently a exporter script from mysql to redis, couchdb and cassandra... the database has 1Mio+ rows...
The text was updated successfully, but these errors were encountered: