michiya / django-pyodbc-azure

Django backend for Microsoft SQL Server and Azure SQL Database using pyodbc
https://pypi.python.org/pypi/django-pyodbc-azure
BSD 3-Clause "New" or "Revised" License
321 stars 140 forks source link

Performance killer: SQL query using nvarchar instead of char #217

Open shubmitt opened 4 years ago

shubmitt commented 4 years ago

This issue has been posted here. I believe it has carried over from this library. So sharing here also.

https://github.com/ESSolutions/django-mssql-backend/issues/50

An example query where conversion is happening -

(@P3 nvarchar(64),@P4 nvarchar(64),@P1 int,@P2 datetime2(7))UPDATE [transactions_transaction] SET [is_split_transaction] = @P1, [modified] = @P2 WHERE ([transactions_transaction].[transaction_id] = @P3 AND [transactions_transaction].[user_id] = @P4)

both user_id and transaction_id are CustomUUIDField (char(32)) and we dont want pyodbc to convert this params