Ajay
Ajay

Reputation: 15

need to get more than 50000 records in mysql query

I need to fetch 50000 records at a time because I can't use limit as I need to sync records from store to crm. Currently if I call 20000 records at a time, it's good but if more than 30000, it's not.

SELECT 
    order_num,
    o.uid AS uid,
    o.create_date AS create_date,
    shipping_name,
    shipping_company,
    shipping_address1,
    shipping_address2,
    shipping_city,
    shipping_state,
    shipping_province,
    shipping_zip,
    shipping_country
FROM
    orders o
        LEFT JOIN
    users u ON o.uid = u.uid
WHERE
    o.status = 'Completed'

I am running this query that results more than 50000 records. Because I am using API to sync these records to another CRM, when running the script, it's showing blank page... Also , if I am using LIMIT 0,20000 .. it's running good

Plz suggest me .. Thanks

Upvotes: 0

Views: 3420

Answers (1)

Steyx
Steyx

Reputation: 646

Depending on the language of your script, i think you're hitting a max execution time and/or memory limit directive. Check your error log for more information and - if you are using PHP - just add the following lines to the beginning of your script to avoid these problems:

ini_set("max_execution_time", "-1");
ini_set("memory_limit", "-1");
ignore_user_abort(true);
set_time_limit(0);

Upvotes: 2

Related Questions