今天,leader看了我写的代码,提了一个建议。我在写p2p业务系统的时候,数据库底层使用了“关联查询,left-join”,leader觉得这样性能不好。他建议,不使用关联查询,每次都是单表查询,如果需要查询关联数据,增加一次查询,然后再把两次甚至多次的数据合并。
即通过程序而不是sql,合并数据。...
分类:
其他好文 时间:
2014-10-30 17:14:49
阅读次数:
214
线程的各种状态如上图所示。
对于wait/notify的测试,我将会留到 生产者消费者模式中实现。
对于join、interrupt的测试如下:
package com.huan;
public class ThreadTest {
public static void main(String[] args) throws Exception{
// joinTest();...
分类:
编程语言 时间:
2014-10-30 17:09:45
阅读次数:
189
6.名称::pthread_detach功能:使线程进入分离状态。头文件:#include 函数原形:int pthread_detach(pthread_t tid);参数:返回值:若成功则返回0,否则返回错误编号。在默认情况下,线程的终止状态会保存到对该线程调用pthread_join,如果线程...
分类:
编程语言 时间:
2014-10-30 15:15:01
阅读次数:
208
表A和表B,现在希望更新A表,当 A.bid = B.id时,a.x = b.x, a.y=b.y,请问mysql中sql语句update a inner join b on a.bid=b.id set a.x=b.x,a.y=b.y ;
分类:
数据库 时间:
2014-10-30 13:10:40
阅读次数:
273
List转字符串,用逗号隔开List list = new List();list.Add("a");list.Add("b");list.Add("c");//MessageBox.Show(list.);//LoadModel();string s = string.Join(",", list...
分类:
其他好文 时间:
2014-10-29 23:55:27
阅读次数:
205
1.在settings.py中使用os.path.dirname()常用代码如下:1 # settings.py2 import os3 PROJECT_DIR = os.path.dirname(__file__)4 STATIC_ROOT = os.path.join(PROJECT_DIR, ...
分类:
其他好文 时间:
2014-10-29 19:01:18
阅读次数:
275
media路径设置:MEDIA_ROOT=os.path.join(BASE_DIR,‘media‘)
MEDIA_URL=‘/media/‘网页中图片无法显示,显示404错误:[28/Oct/201411:03:15]"GET/media/photos/44.thumb.JPGHTTP/1.1"4042528解决方法:根据DJANGO1.6文档-6.19.2static():设置项目URL文件:fromdjango.confimpo..
分类:
Web程序 时间:
2014-10-29 02:11:07
阅读次数:
221
先过滤条件然后再根据表连接 同时在表中建立相关查询字段的索引这样在大数据多表联合查询的情况下速度相当快SELECT M.*,SS.SensorCode,SS.SensorStatus,SS.ManufacturerId,SS.Electricity,SS.Voltage,SS.MinElectric...
分类:
数据库 时间:
2014-10-28 17:31:51
阅读次数:
232
fetch ,可以设置fetch = "select" 和 fetch = "join"用一对多来举例:fetch = "select"是在查询的时候先查询出一端的实体,然后在根据一端的查询出多端的实体,会产生1+n条sql语句;fetch = "join"是在查询的时候使用外连接进行查询,不会差生...
分类:
Web程序 时间:
2014-10-28 13:43:22
阅读次数:
233
When working with variables that contain strings or numbers. There's often a need to join their values. Either to display directly on screen or to sto...
分类:
其他好文 时间:
2014-10-28 13:37:01
阅读次数:
178