# Topic.reset\_all\_highest esaurisce tutto lo spazio su disco disponibile

**URL:** <https://meta.discourse.org/t/topic-reset-all-highest-exhausts-all-available-disk-space/333837>\
**Category:** Bug\
**Created:** [31 Ottobre 2024, 2:00pm UTC](https://meta.discourse.org/t/topic-reset-all-highest-exhausts-all-available-disk-space/333837 "2024-10-31T14:00:32Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![pgcd](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pgcd/32/386957_2.png) [@pgcd](https://meta.discourse.org/u/pgcd)\
**Post date:** [31 Ottobre 2024, 4:44pm UTC](https://meta.discourse.org/t/topic-reset-all-highest-exhausts-all-available-disk-space/333837/3 "2024-10-31T16:44:59Z")

</div>

Dopo che i primi due frammenti del mio esperimento “split query” sono andati a buon fine (X e Y per argomenti pubblici), ho provato con quello Z, e si è bloccato - cioè, la query era attiva secondo l’attività di postgres, e `top` mostrava il processo in esecuzione al 100%.  
Così ho guardato di nuovo l’SQL e ho trovato il problema: entrambe le query terminano così

```plaintext
      WHERE
        topics.archetype <> 'private_message' AND
        X.topic_id = topics.id AND
        Y.topic_id = topics.id AND
          (
          topics.highest_staff_post_number <> X.highest_post_number OR
          topics.highest_post_number <> Y.highest_post_number OR
          topics.last_posted_at <> Y.last_posted_at OR
          topics.posts_count <> Y.posts_count OR
          topics.word_count <> Z.word_count
        )

```

(l’altra ha ‘private\_message’ come archetipo, ovviamente)  
Il che significa che alla query manca  
`Z.topic_id = topics.id` - il che causa l’intero aumento geometrico.

Modificare la clausola WHERE delle query in

```plaintext
      WHERE
        topics.archetype <> 'private_message' AND
        X.topic_id = topics.id AND
        Y.topic_id = topics.id AND
        Z.topic_id = topics.id AND
          (
          topics.highest_staff_post_number <> X.highest_post_number OR
          topics.highest_post_number <> Y.highest_post_number OR
          topics.last_posted_at <> Y.last_posted_at OR
          topics.posts_count <> Y.posts_count OR
          topics.word_count <> Z.word_count
        )

```

ha risolto il problema per me.

Dovrei aprire una PR?

---

_[View the full topic](https://meta.discourse.org/t/topic-reset-all-highest-exhausts-all-available-disk-space/333837)._
