简体   繁体   中英

Wordpress insert thousands of records

I am facing issue server execution timeout and sometime maximum memory used.

I want to insert 30k records into database from a CSV.

The issue is everything is going through the one loop.

I have changed the entries in wp-config and php.ini like excution time = 0 , maximum memory = -1 . This has solved the FATAL errors but leaking memory. HTTPD eats all my computer ram and still has to process 25K records.

I would like to release memory after every insertion (I am using wordpress default function to insert in to database not SQL).

I have searched alot and found that in SQL we can write GO after insert query this releases the memory but what we can do in wordpress.

I am using CSV import export plugin to import CSV. [Please don't recommend WP-All import it is not fulfilling my requirement to enter data in custom field in taxonomy].

Calling :

wp_cache_flush(); 

Solved my issue.

您可以使用禁用当前请求的缓存

wp_suspend_cache_addition(true);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM