Mysql script getting stuck after fetching records more than 30000

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

Answers


You can try

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
    ( SELECT * FROM users WHERE o.status = 'Completed' ) as u
 ON o.uid = u.uid

This can reduce the join time


Need Your Help

UILabel allocation persistent and taking up 8Mb of memory

objective-c xcode instruments xcode-instruments

I have a set of labels that are placed within a set of UIViews inside a single UIScrollView.

ScrollView Inside ScrollView

android scrollview

I Know people from Google have asked us not to put Scrollable view inside another Scrollable view but is there any official statement from them directing us not to do so?