3

I have a forum which allows users to enter large amounts of text along with (sanitized) html (and/or markdown) and links, etc. Everything is sanitised and checked before it is stored in the database.

Would it be a good idea to use gzcompress. I've heard that it is not good if you intend to search this text. Should I compress the content before saving it to the database and use only the title and tags for searching, or does it not matter?

john mossel
  • 2,158
  • 5
  • 24
  • 39
  • 2
    Well, answer this: What *advantages*, if any, does using `gzcompress` add in this scenario? Theoretical "because it shrinks data" doesn't count *unless* it can be justified *with a good use-case* -- e.g. is database space really at a premium (and does the compression of data reduce usage to *within* functional-requirements)? Is the reduced IO *required* to meet functional-requirements (assuming it does increase performance)? The more little "optimizations" like this, the harder the data/model is to work with. –  Mar 19 '11 at 17:31

1 Answers1

2

I would store the content as text. Then, if space becomes a problem, you can explore an optimization like this later.

You may find this discussion worth reading: Planning for efficiency early vs Premature optimization

Community
  • 1
  • 1
Nick Clark
  • 4,439
  • 4
  • 23
  • 25