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


Reply via email to