I would like to know if, when doing "php bin/magento indexer:reindex" the folders "var", "generated" and "pub/static" have to be writable ?

Alternatively, does reindexing only work at database level?

All advice and opinions are welcome! Thanks!

1 Answer 1


As per my knowledge, indexing is done only on database level.

Magento Indexer tracks database changes for a certain entity and performs re-index if required.

So, if we talk about:

var: it contains cache,log report etc 
generated: contains class files
pub/static : Static view files

For testing purpose, I have set sudo chmod -R 444 . to var,generated and pub/static folder then ran indexer and it worked!

You can check more detail at: official document

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.