---
title: "在Sql Server中使用pst根据字符型类型查询的性能问题"
author: "jlj008"
date: "2009-03-23T10:59:30Z"
tags: []
categories: ["数据库"]
slug: "sql-server-pst"
draft: false
lastmod: "2010-08-02T16:40:12Z"
id: 353435
url: "https://jimjiang.iteye.com/blog/353435"
---

问题：在使用mssqlserver的jdbc时，当根据字符型列来查询时，使用pst会产生性能问题，主要是因为在dburl中的SendStringParametersAsUnicode默认为true，所导致的（原因就不说了，可以查下文档），但如果直接使用statement.executeQuery(sql)就没有这个性能问题。

解决方案：
如果数据库创建的时候类型是unicode的，那可以把SendStringParametersAsUnicode设为false，其它无需任何改动，性能就和直接statement.executeQuery一样了。