-1

I am using cherrypy to handle get requests that pass a input parameter (basically a 32 bit string) and I use this 32 bit string to query a table in database. I observed that by default the string is in unicode and the queries takes more than 2 seconds to execute. But if I encode the string to utf-8 and then query, the execution time is around 10ms. Note that the database (mssql)'s encoding is utf-8.

Any idea why this might be happening?

andor
  • 75
  • 8

1 Answers1

0

This is probably because, as you mentioned, mssql requires utf-8 encoding. So therefore when you launch a 32-bit string as your query, the server itself probably performs some cast or transformation operation from 32-bit to utf-8, therefore increasing your run time slightly (vs just sending it in the proper format)

artemis
  • 6,857
  • 11
  • 46
  • 99