CHAR vs NVARCHAR vs TEXT performance

Поиск
Список
Период
Сортировка
От Rob
Тема CHAR vs NVARCHAR vs TEXT performance
Дата
Msg-id fdf296a6ed074e63dc6d8d54043fc532@mintsoft.net
обсуждение исходный текст
Ответы Re: CHAR vs NVARCHAR vs TEXT performance  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-hackers
Hi Guys,

I wanted to get some thoughts about a type-specific performance problem 
we hit
through our application tier.

The full conversation is here: 
https://github.com/npgsql/npgsql/issues/2283

Basically, if a table exists with a PK which is CHAR(n) and a query is 
sent with
VARCHAR or CHAR then it uses an Index Scan. If the query is sent with 
TEXT as the
type then postgresql casts the column to TEXT (rather than the value to 
CHAR) and
it does a Seq Scan.

So far this has only showed itself on npgsql (I've been unable to 
reproduce on
other drivers), I think it's because npgsql only sends TEXT whereas 
other drivers
tend to send VARCHAR (other drivers includes the official JDBC driver).

I guess the root question is: is TEXT supposed to be identical to 
VARCHAR in all scenarios?

Thanks,
Rob



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Andres Freund
Дата:
Сообщение: Re: Race conditions with checkpointer and shutdown
Следующее
От: Tom Lane
Дата:
Сообщение: Re: Race conditions with checkpointer and shutdown