请帮助我提高mysql,php中的查询执行速度 [英] kindly help me to improve the query execution speed in mysql,php

查看:70
本文介绍了请帮助我提高mysql,php中的查询执行速度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在数据库中,我有帐户详细信息表,其中包含大约300000条记录。



基于以下查询我必须在表格中显示报告,帐户名称和选定的公司价值



年度明智,近40行13列



i有查询,

  $ sql  =(  SELECT sum(value)as val FROM balancesheet其中formula ='$ formulaid'和year ='$ year'和nse_code ='$ companyCode'); 





基于年份,公司和公式,这里的公式字段,假设公式为1 + 2 + 3表示,

查询将在循环内执行3次并继续使用父循环



o / p:将会像



 2012 2011 2000 ......... 
帐户名1 15.00 16.08 47.55
帐户名2 15.00 16.08 47.5 5
.......



所以打印时间不到4到5分钟。



请帮助我如何改进查询的执行以打印紧固

解决方案

sql =( SELECT sum(value)as val FROM balancesheet其中formula ='


< blockquote> formulaid'和year ='


year'和nse_code ='


In database,i have accounts details table, that contain approx.,300000 records.

based on the below query I have to show the report in table, account name and selected company value

in year wise, nearly 40 rows and 13 columns

i have the query,

$sql = ("SELECT sum(value) as val FROM balancesheet where formula='$formulaid' and year='$year' and nse_code='$companyCode'");



based on the year, company, and formula, here formula field, suppose if formula is 1+2+3 means, the
query will execute 3 times inside the loop and continue again with parent loop

o/p: will be like

		2012      2011     2000.........
account name1	15.00     16.08    47.55
account name2	15.00     16.08    47.55
.......	


so hardly it takes 4 to 5 mins to print.

Kindly help me how to improve the execution of query to print faste

解决方案

sql = ("SELECT sum(value) as val FROM balancesheet where formula='


formulaid' and year='


year' and nse_code='


这篇关于请帮助我提高mysql,php中的查询执行速度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆