问题1:随着数据库表的大小变大,如何调整MySQL以提高LOAD DATA INFILE调用的速度?
问题2:是否会使用一组计算机来加载不同的csv文件,提高性能还是杀死它?(这是我明天使用负载数据和批量插入的基准测试任务)
我们正在为图像搜索尝试不同的特征检测器和聚类参数组合,因此我们需要能够及时构建大型数据库.
如果有办法通过分发数据库来改善创建时间,那么机器有256 gig的ram,另外还有2台机器可以使用相同数量的ram?
表模式看起来像
+---------------+------------------+------+-----+---------+----------------+
| Field | Type | Null | Key | Default | Extra |
+---------------+------------------+------+-----+---------+----------------+
| match_index | int(10) unsigned | NO | PRI | NULL | |
| cluster_index | int(10) unsigned | NO | PRI | NULL | |
| id | int(11) | NO | PRI | NULL | auto_increment |
| tfidf | float | NO | | 0 | |
+---------------+------------------+------+-----+---------+----------------+
mysql optimization binaryfiles query-optimization large-data
我正在尝试将一个简单的socket.io聊天应用程序捆绑到本机应用程序中,以便在Android 2.2及更高版本上使用phonegap运行.
我有一个运行socket.io的简单服务器,当它在Web浏览器中运行时,它成功地与socket.io客户端通信.
需要注意的是,因为WebSockets的支持的arent在Android 2.2则默认回XHR轮询,通过Web浏览器在Android 2.2的连接时,从服务器消息样本
[root@webnode-2 nodechat]# node server.js
info - socket.io started
debug - client authorized
info - handshake authorized 6036976111002307981
debug - setting request GET /socket.io/1/xhr-polling/6036976111002307981?t=1332184313758
debug - setting poll timeout
debug - client authorized for
debug - clearing poll timeout
debug - xhr-polling writing 1::
debug - set close timeout for client 6036976111002307981
6036976111002307981
debug - setting request GET /socket.io/1/xhr-polling/6036976111002307981?t=1332184313839
debug - setting poll …
由于这是我的第一篇文章,似乎我只能发布1个链接,所以我列出了我在底部指的网站.简而言之,我的目标是让数据库更快地返回结果,我试图包含尽可能多的相关信息,以帮助构建帖子底部的问题.
8 processors
model name : Intel(R) Xeon(R) CPU E5440 @ 2.83GHz
cache size : 6144 KB
cpu cores : 4
top - 17:11:48 up 35 days, 22:22, 10 users, load average: 1.35, 4.89, 7.80
Tasks: 329 total, 1 running, 328 sleeping, 0 stopped, 0 zombie
Cpu(s): 0.0%us, 0.0%sy, 0.0%ni, 87.4%id, 12.5%wa, 0.0%hi, 0.0%si, 0.0%st
Mem: 8173980k total, 5374348k used, 2799632k free, 30148k buffers
Swap: 16777208k total, 6385312k used, 10391896k free, 2615836k cached
Run Code Online (Sandbox Code Playgroud)
但是,我们正在考虑将mysql安装移动到具有256 GB RAM的群集中的其他计算机
我的MySQL表看起来像
CREATE …Run Code Online (Sandbox Code Playgroud) 我试图将二进制文件读入结构数组
struct FeaturePoint
{
FeaturePoint (const int & _cluster_id,
const float _x,
const float _y,
const float _a,
const float _b
) : cluster_id (_cluster_id), x(_x), y(_y), a(_a), b(_b) {}
FeaturePoint (){}
int cluster_id;
float x;
float y;
float a;
float b;
};
Run Code Online (Sandbox Code Playgroud)
下面的代码可以工作,但是通过将每个新元素推送到数组上,一次完成这一个元素
void LoadImageFeaturesFromBinaryFile(const char * FileName, std::vector<FeaturePoint>& features )
{
char strInputPath[200];
strcpy (strInputPath,"/mnt/imagesearch/tests/");
strcat (strInputPath,FileName);
strcat (strInputPath,".bin");
features.clear();
ifstream::pos_type size;
ifstream file (strInputPath, ios::in|ios::binary|ios::ate);
if (file.is_open())
{
size = file.tellg();
cout<< "this file size is : …Run Code Online (Sandbox Code Playgroud) 我想做一些事情
CREATE DATABASE IF NOT EXISTS @database_name;
从阅读准备语句的mysql语法看来,它们似乎无法用于创建数据库,否则这样的东西就可以了.
SET @s = CONCAT('CREATE DATABASE IF NOT EXISTS ',@database_name);
PREPARE stmt FROM @s;
EXECUTE stmt;
理想情况下,我希望它可以从shell脚本的.sql文件中运行
#!/bin/bash
MYSQL="mysql"
`${MYSQL} --version >& /dev/null`
if [ $? != 0 ]; then
MYSQL="mysql5"
`${MYSQL} --version > /dev/null`
if [ $? != 0 ]; then
echo "Can't find mysql binary?"
exit 1
fi
fi
${MYSQL} -u root --password=###### -e "set @database_name:='ben_search';source CreateSkeleton.sql;"
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
在我的慢查询日志中,我看到的是慢查询
# Time: 121107 16:34:02 # User@Host: web_node[web_node] @ localhost [127.0.0.1] # Thread_id: 34436186 Schema: test_db Last_errno: 0 Killed: 0 # Query_time: 1.413751 Lock_time: 0.000222 Rows_sent: 203 Rows_examined: 203 Rows_affected: 0 Rows_read: 203 # Bytes_sent: 7553 Tmp_tables: 0 Tmp_disk_tables: 0 Tmp_table_sizes: 0 # InnoDB_trx_id: 9B04384 SET timestamp=1352334842; SELECT id, email FROM test_data WHERE id IN (13089576,3002681,3117763,1622233,2941590,12305279,1732672,2446772,3189510,13084725,4943929,5855071,6572137,2266261,3003496,2024860,3336832,13758671,6477694,1796684,13001771,4690025,1071744,1017876,5175795,795988,1619821,2481819,2941090,4770802,13438250,3254708,2323402,526303,13219855,3313573,3190479,1733761,3300577,2941758,6474118,1733379,11523598,4205064,6521805,2492903,1860388,3337093,5205317,1213970,5442738,12194039,1214203,12970536,3076611,3126152,3677156,5305021,2751587,4954875,875480,2105172,5309382,12981920,5204330,13729768,3254503,5030441,2680750,590661,1338572,7272410,1860386,2567550,5434143,1918035,5329411,1683235,3254119,5175784,1855380,3336834,2102567,4749746,37269,3207031,6464336,2227907,2713471,3937600,2940442,2233821,5619141,5204711,5988803,5050821,10109926,5226877,5050275,1874115,13677832,5338699,2423773,6432937,6443660,1990611,6090667,6527411,6568731,3254846,3414049,2011907,5180984,12178711,8558260,3130655,5864745,2059318,3480233,2104948,2387703,1939395,5356002,2681209,1184622,1184456,10390165,510854,7983305,795991,2622393,4490187,9436477,5356051,2423464,5205318,1600499,13623229,3255205,12200483,6477706,3445661,5226284,1176639,13760962,2101681,6022818,12909371,1732457,2377496,7260091,12191702,2492899,2630691,13047691,1684470,9382108,2233737,13117701,1796698,2535914,4941741,4565958,1100410,2321180,13080467,813342,4563877,4689365,2104756,1102802,2714488,3188947,1599770,1558291,5592740,5233428,5204830,1574452,3188956,13693326,2102349,3704111,1748303,790889,9323280,4741494,2387900,5338213,3583795,2283942,3189482,3002296,4490123,3585020,962926,3481423,1600920,1682364,4693123,6487778,2677582,2377195);
当我使用SQL_NO_CACHE通过探查器运行慢速查询时,它看起来如此
203 rows in set (0.03 sec) show profile for query 33; +----------------------+----------+ | Status | Duration | +----------------------+----------+ | starting | 0.000187 | …
mysql innodb query-optimization database-performance mysql-slow-query-log
我有一个HTML渲染问题,最初我是从模拟加载数据,它看起来像这样.

当我注释掉添加了模拟数据的代码时,我的页面没有正确呈现所有元素

如果我将鼠标悬停在一个元素上,它会渲染它

如果我添加一个空行
<div class="table-responsive">
<table class="table table-striped table-bordered table-hover">
<thead>
<tr>
<th></th>
<th>Task</th>
</tr>
</thead>
<tbody id="todoListTasksHome">
<tr></tr>
<tr id="task_1">
<td style="width:64px"><button class="btn btn-minier btn-green" onclick="completeTask( 1 )">complete</button></td>
<td>description</td>
</tr>
</tbody>
</table>
</div>
Run Code Online (Sandbox Code Playgroud)
有用

代码看起来在模拟数据中添加了
var load_todo_list_tasks = function () {
var loadedData = [
{
"comment": "",
"task": "Go see a chiro",
"task_id": 123,
"completed": false,
"completed_date": "",
"set_date":"07/08/13"
}];
if (loadedData.length>0){
$("#tasks_completed").hide();
$("#tasks_home_completed").hide();
numberTasksForToday=0;
for (var i = 0; i < loadedData.length; i++) {
var data …Run Code Online (Sandbox Code Playgroud) mysql ×4
binaryfiles ×2
android ×1
c++ ×1
caching ×1
cordova ×1
css ×1
database ×1
html ×1
ifstream ×1
innodb ×1
jquery ×1
large-data ×1
memcachedb ×1
node.js ×1
optimization ×1
socket.io ×1
subquery ×1
variables ×1