Which mysql method is fast?

I store some text in a database, say 1000 characters. But I only show the first 200 characters.

Method 1
I could save the first 200 characters in one column and the rest in the second column of the sql table

Method 2
I can save everything in one column and show that I can request 200 characters

+5
source share
4 answers

It would be "cleaner" to store everything in 1 column. and you can only select the first 200 characters, such as

select substring(your_column, 1, 200) as your_column from your_table
+4
source

, , 1 , ( , ), substring on ( ...). 2 , , 1.

+1

:

PHP, 200 , :

, , PHP - .

. , . , , , .

0

2.

-, (). .

-, .

-, (. # 1).

-, 200 , ( 200 ).

Fifth, even if you are looking for the first 200 characters, you can index them, and the search speed should be identical.

Sixth, you do not want the database design to limit your UX - what if you need to change up to 500 characters? You will have a lot of work.

This is a very obvious case of what you do not need to do in database design.

reference: as Joe Amison answered http://www.quora.com/MySQL/Which-mysql-method-is-fast

0
source

All Articles