Home > Back-end >  On a query in Chinese, the efficiency of the digital problem
On a query in Chinese, the efficiency of the digital problem

Time:10-23

Article 1, it is assumed that the table has 100000 data
2, the query condition is the WHERE Name='captain'
3, the query condition is the WHERE Name='1'

1 representative is captain, 0 is not representative of captain

The query "captain" in Chinese will be much slower than the query '1'?

I have necessary raising such a field in the database used to as a query to use? Captain or query directly in Chinese?

CodePudding user response:

In theory, the captain or 1, it will not have the too big distinction on the query efficiency,
Under normal circumstances, we will reduce the "captain", "vice captain", and "members" such as a dictionary of data, and carries on the management, and to use in other places is refer to the corresponding coding (or ID),
As for you want to add a special storage for 1 field, is technically possible (without considering whether reasonable),

Efficiency, storage, safety is the most basic database design, to consider problems, based on the personal advice you need to learn "database paradigm",

CodePudding user response:

The building Lord think too much, if change to number 1, 0 said the captain, the captain, is faster than using character (in the case of have the index also difference is very small), the same character, 'captain' and '1' search efficiency is the same (assuming that there is an index)
  • Related