![]() |
![]() |
![]() |
|
|
#1 |
|
01-AGF / 01-ASI
Join Date: Aug 2007
Location: Paris
Posts: 169
![]() |
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;
__________________
Regards 01 Annuaire AESW - 01 Annuaire LD - 01 Topsites - Depannage Informatique Location Ordinateur - Jeu de Poker |
|
|
|
![]() |
| Thread Tools | |
| Display Modes | |
|
|