Hi,
I have some fixed length text fields, that are for now only partially filled. For these, when I select them, I get a lot of empty space after the text, and it remains so in variables. Is there a way to "prune" the empty space, for example before the DAO is instantiated, or before the result is returned in "non-DAO" selects?
BTW, my reasoning in creating fixed length text fields is that postmodern should be faster than with the fields with variable length. I can still change that.
Hi Slobodan,
Firstly, I very much doubt Postmodern will be faster for fixed-length fields. I doesn't special-case them at all, so they are sent in the exact same way as other strings. And even if they were, there is no reason they'd be faster -- the Postgres protocol null-terminates every string.
But if you need fixed-width fields, you can probably add a initialize-instance :after method to your DAO class that sanitizes the strings.
Best, Marijn
2011/2/28 Marijn Haverbeke marijnh@gmail.com:
Hi Slobodan,
Firstly, I very much doubt Postmodern will be faster for fixed-length fields. I doesn't special-case them at all, so they are sent in the exact same way as other strings. And even if they were, there is no reason they'd be faster -- the Postgres protocol null-terminates every string.
I meant that I thougth that postgresql could be faster with fixed lenght fields, not postmodern, sorry... :-D
But if you need fixed-width fields, you can probably add a initialize-instance :after method to your DAO class that sanitizes the strings.
Yes, I understand. And for "regular" select, I can cleanup vars by myself anyway. Thanks!
2011/2/28 Marijn Haverbeke marijnh@gmail.com:
I meant that I thougth that postgresql could be faster with fixed lenght fields, not postmodern, sorry... :-D
Benchmark this, before you make life hard for yourself. I seem to remember an expert telling me that fixed char columns are rarely useful anymore.
Well, I guess I'm not up to date with the latest DB development. :-)
I can still change columns to varchar, so I think I'll do just that, which will simplify things for me. Thanks again for the advice!
Quoth Marijn Haverbeke marijnh@gmail.com:
I meant that I thougth that postgresql could be faster with fixed lenght fields, not postmodern, sorry... :-D
Benchmark this, before you make life hard for yourself. I seem to remember an expert telling me that fixed char columns are rarely useful anymore.
http://www.postgresql.org/docs/8.3/interactive/datatype-character.html
"There are no performance differences between [character, character varying & text data types], apart from increased storage size when using the blank-padded type, and a few extra cycles to check the length when storing into a length-constrained column. While `character(N)' has performance advantages in some other database systems, it has no such advantages in PostgreSQL. In most situations `text' or `character varying' should be used instead."
Seb
postmodern-devel@common-lisp.net