普通网友 2019-02-08 04:45
浏览 36

在Codeigniter上查询大数据需要太长时间

I'm creating a small site for importing data from Oracle to SQL Server database, but it taking too long and using too much memory. I've tried the query by using SQL developer and SQL Server Management and both run fast and no error.

I'm using below code to retrieve the data from Oracle database :

$data = $this->oracle->query($query);
$oracle_data = $this->model_oracle->get_headers($a)->result_array();

And using below code to insert it into SQL Server :

$sqlsrv->trans_start();
$sqlsrv->truncate('tr_header');
$sqlsrv->insert_batch('tr_header',$header_oracle);
$sqlsrv->trans_complete();

There's no calculation or data processing, only get and insert. The data is about 140.000 rows, and it took more than 1 hour to complete and used more than 200MB memory (from php.ini). I believe there's no issue on my query, because if i have to compare it with how it ran in other program:

Select on SQL Developer : 1-2 mins

Insert on SQL Server : <1 min

Using SSIS : ~10 mins

So, is there any way to improve the performance?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥20 双层网络上信息-疾病传播
    • ¥50 paddlepaddle pinn
    • ¥20 idea运行测试代码报错问题
    • ¥15 网络监控:网络故障告警通知
    • ¥15 django项目运行报编码错误
    • ¥15 请问这个是什么意思?
    • ¥15 STM32驱动继电器
    • ¥15 Windows server update services
    • ¥15 关于#c语言#的问题:我现在在做一个墨水屏设计,2.9英寸的小屏怎么换4.2英寸大屏
    • ¥15 模糊pid与pid仿真结果几乎一样