Pb Recount - eSyndiCat User Forums
eSyndiCat User Forums esyndicat directory software esyndicat support

Go Back   eSyndiCat User Forums > International > French

Reply
 
Thread Tools Display Modes
Old 01-09-2008   #1
pmadfm
01-AGF / 01-ASI
 
Join Date: Aug 2007
Location: Paris
Posts: 169
pmadfm is on a distinguished road
Thumbs up Pb Recount

Bonjour,

Suite au nombre important de catégories dans mon annuaire version 2.201 (20 000) la fonction RECOUNT ne fonctionne plus, il consomme une tonne de ressources et part dans les décors.

Alors en attendant une solution du jelpdesk, j'ai développé un petit script MySQL que je vous fournis à tout hasard ;-)

Code:
update `v2201_categories` a
set num_listings=0;

update `v2201_categories` a
 set num_listings=(select count(*) from v2201_listings b
                  WHERE b.category_id=a.id);

create table temp 
  select id, num_listings from v2201_categories
 where num_listings;

ALTER TABLE `temp` ADD UNIQUE INDEX ( `id` );

update `v2201_categories` a
  set num_all_listings=
   (select sum(num_listings) from temp b, v2201_flat_structure c
    where b.id=c.category_id and a.id=c.parent_id
    group by c.parent_id);

drop table temp;
De 10 minutes CPU de MySQL avec plantage, je suis passé à 5 secondes elaps avec réussite.
pmadfm is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT. The time now is 02:20 AM.


Powered by vBulletin® Version 3.7.0
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Testimonials | Articles | Support | Documentation | Privacy Policy | License | Affiliates | Contact Us