Subject Re: External files Current timestamp
Author Adam
--- In firebird-support@yahoogroups.com, <mahendra.nepali@...> wrote:
>
> Hi,
>
> I am trying to check the performance monitoring of a procedure. For that
> at various levels in the procedure, I am writing to an external file. I
> am also logging the time the insert statement was fired to write into
> the external file using current_timestamp system variable. However all
> the records into the external table the timestamp value doesn't vary at
> all. All the values appear the same.
>
>
>
> The following is the external table query
>
> create table portfolioextern external file
>
> 'd:\temp\portfolioextern.txt'
>
> (ID CHAR(16),operationcompleted char(64), PROCNAME VARCHAR(32), LOGDATE
> CHAR(30))
>
>
>
> The sample insert query that is fired within the procedure at various
> levels in it.
>
> INSERT INTO PORTFOLIOEXTERN VALUES
>
> ('123456789012','TESToperation','TESTPROC',CURRENT_TIMESTAMP)
>
>
>
> All the values in the LOGDATE column are same though the procedure takes
> an hour plus to complete.
>

Others have already explained to use 'NOW' instead of
CURRENT_TIMESTAMP for this purpose because CURRENT_TIMESTAMP remains
constant for the operation whereas NOW changes every time it is called.

I just wanted to point out that writing to a file is a slow operation,
and depending on how you use this information, the fact that you are
logging it to disk may cause it to take twice as long to complete. One
option under windows is to make use of the OutputDebugString Windows
API wrapped inside a UDF you write, then use a debug monitor to watch
the messages come through. Much less expensive in my experience.

Adam