cancel
Showing results for 
Search instead for 
Did you mean: 

Huge core_url_rewrite table

Huge core_url_rewrite table

Hi,

We have some 45,000 products on our website and the core_url_rewrite table size has already reached 28 lakh plus and it is keep on increasing with every subsequent product upload or if any product is edited (I Guess). This has greatly slowed our website search feature and other functionalities .

If someone can help us out with this problem i will be very grateful as this issue is highly affecting our business. We don't have multiple stores and only one store is there

We are using Magento 1.9.2.2 CE version

9 REPLIES 9

Re: Huge core_url_rewrite table

what's a lakh?

 

p.s. a search on this issue will easily give several hits/solutions.

Re: Huge core_url_rewrite table

@makispalasis According to Wikipedia, a lakh is a unit in the Indian numbering system equal to one hundred thousand (100,000).

 

@KiranBhushan The best solution available so far is from StackExchange:-

https://magento.stackexchange.com/questions/17553/magento-core-url-rewrite-table-excessively-large

 

I'll include the solution here so it's easier for others to reference it and just in case the contents in StackExchange are no longer there in the future.

 

Open up this file:-

app/code/core/Mage/Catalog/Model/Url.php

 

Look around line 807 and replace these lines:-

if ($product->getUrlKey() == '' && !empty($requestPath)
   && strpos($existingRequestPath, $requestPath) === 0
) 

With the following lines:-

if (!empty($requestPath)
           && strpos($existingRequestPath, $requestPath) === 0
) 

Then, go to your MySQL database and truncate the core_url_rewrite table.

 

Finally, run the reindexing for Core URL Rewrites and flush Magento cache & cache storage. 

 

Re: Huge core_url_rewrite table

quick reply related to the truncate issue:

Any time I see someone recommend a truncate on a table about data that *can* be customizable/used by non-core functions in a platform like Magento; it immediately puts me off the answer.

I have seen this answer before, and I will continue to ignore it.

 

Truncating that table is not a valid step in any solution in my opinion: You can never be sure if the end party has other valuable data in that table being used by other non-core modules... nor can you be sure if that data can be automatically re-created.

Re: Huge core_url_rewrite table


@makispalasis wrote:

quick reply related to the truncate issue:

Any time I see someone recommend a truncate on a table about data that *can* be customizable/used by non-core functions in a platform like Magento; it immediately puts me off the answer.

I have seen this answer before, and I will continue to ignore it.

 

Truncating that table is not a valid step in any solution in my opinion: You can never be sure if the end party has other valuable data in that table being used by other non-core modules... nor can you be sure if that data can be automatically re-created.


I am merely posting the solution from StackExchange which has the most upvote. I am not a developer so I will not be debating on whether this feels like a valid step or not. 

 

If you know of a better solution, please do post it here so you will be able to help not just @KiranBhushan but also any other visitors who stumble upon this forum post. Asking the user to search for a solution on his own is not helpful as even you failed to do so when it comes to the word "lakh". 

Re: Huge core_url_rewrite table

Been a while since I did that,

I think it was this one:

https://github.com/biotech/Magento-URL-Rewrite

it's amongst the answers in the same SE Question you posted.

 

Will have to look into it again next month, note to self: update this answer then.

Re: Huge core_url_rewrite table

HI JLHC,

Sorry for late reply as i was not well,

By truncating core_url_rewrite table do you mean deleting all the entries ?

Will that have any effect on the SEO work done so far on the keywords. 

 

Regards

Kiran Bhushan

 

Re: Huge core_url_rewrite table

Hi makispalasis,

 

Sorry for late reply as i was not well.

I am new to magento the solution provided in the link is to copy the url.php file in 

 app/code/local/Mage/Catalog/Model/ directory, but will this solve the solution permanently .

 

By 28 lakh plus entries i mean 2.8 million plus records which is going exponentially with every new product upload.

 

Regards

Kiran Bhushan

 

 

 

Re: Huge core_url_rewrite table


@KiranBhushan wrote:

HI JLHC,

Sorry for late reply as i was not well,

By truncating core_url_rewrite table do you mean deleting all the entries ?

Will that have any effect on the SEO work done so far on the keywords. 

 

Regards

Kiran Bhushan

 


You'll need to seek advice from your developer as I'm not a developer so I won't be able to advise you about that. 

Re: Huge core_url_rewrite table

We have battled with core_url_rewrite issues for years, especially since previous versions of Magento occasionally made the issue worse.

 

For SEO, you shouldn't just truncate the table.

 

This is the best approach to the solution that I have found so far:

 

https://thedeveloperworldisyours.com/magento/how-we-solved-magento-core_url-issues-once-and-for-all/