chicken-users
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-users] postgresql tests/run.scm line 17 ff.


From: Herr
Subject: Re: [Chicken-users] postgresql tests/run.scm line 17 ff.
Date: Sun, 03 Mar 2013 20:22:48 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130215 Thunderbird/17.0.3

Am 03.03.2013 17:57, schrieb Peter Bex:
> On Sun, Mar 03, 2013 at 05:50:30PM +0100, Herr wrote:
>> Tcl: it is extremely succinct, getting the result as flat list covers all 
>> the uses
>> where the select column list does not change. With some small helpers a 
>> typical
>> pattern is:
>>
>> foreach {fname lname email} [pg_query_list "select fname, lname..."] {
>>      # variables are bound to the row values, go ahead
>> }
> 
> That's convenient, but what does it do with typed values?
> 

In Tcl everything is a string, EIAS, in the first place. For performance binary
representation of variables might be cached, internally and transparently.

Now SQL also is a string based language in the first place, so there is always a
string representation of a datum. Especially in Postgresql you might get better
execution plans from a query completely composed as a string, as opposed to 
prepared
statements (because the one-shot query is more selective than the query with
place-holders).

Problems arise always with types like "timestamp with time zone", because the 
string
representation must be parsed by your program, which might be a lot of work.

But this is just "normal business", programmer's business. You could for example
convert it to unix epoch, and try to offload every date/time calculation to the
database, where the data is.

This is application programming, not symbolic computation.

/Str.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]