0

I am using codeingiter database backed sessions. It is possible that the session data could exceed the length of a text data type field (MYSQL). If I were to use LONGTEXT what are the performance ramifications of such a change? Obviously sessions are used a lot so if there is a bit performance problem, I will have to set a limit to the amount of data stored in the session.

I know some are going to argue that I shouldn't be using database backed sessions, but this is a different question so please just answer the question above.

Chris Muench
  • 17,444
  • 70
  • 209
  • 362
  • related: http://stackoverflow.com/questions/13932750/tinytext-text-mediumtext-and-longtext-in-mysql-maximum-storage-sizes – Cypher May 02 '14 at 23:18

1 Answers1

0

TEXT can hold up to 64 Kilobytes
LONGTEXT can hold up to 4 Gigabytes

I do not think you should have session data that are larger than 64Kb of data. The serialization would add latency to you application. Even 64Kb seems large.

Are you able to reduce the size of the data you are storing in your sessions?

rmcfrazier
  • 444
  • 4
  • 8
  • I have only had one customer complain as they added 200 items to a sale with long descriptions (typed in). I am just trying to cover that use case. It won't happen often, but it happened. – Chris Muench May 03 '14 at 00:37
  • You should be able to use LONGTEXT, just hope that not too many people actually have a need for that much space. – rmcfrazier May 03 '14 at 03:45