profiler GET

Post Reply
wtian
Posts: 11
Joined: Thu Apr 05, 2001 3:23 pm

profiler GET

Post by wtian »

I am trying to use profiler in my script.
My understanding is that the function

<profiler GET $msg> will generate a string/list which
I can later use in the likein clause. I have a profiler
table setup as

create table profiles
( id counter,
Query varchar(200),
..... -- other fields
)

I created index as:

create metamorph counter index xmmprofilestext
on profiles(Query);

and here is the testing function:


<a name=simpletry public>
<profiler INIT profiles testprofile Query>
<$mymsg = "Linux kernel distribution is free">

<sum "%s" "select id,Query from profiles where Query likein '" $mymsg "'">
<TABLE border=1>
<tr><th>Original msg</th><td>$mymsg</td>
<tr><th>Text to match </th><td>$mymsg</td>
<tr><th>Command</th><td>$ret</td></tr>
</TABLE>

<TABLE border=1>
<tr><th>id</th><th>Query</th></tr>
<!-- SQL $ret -->
<SQL "select id,Query from profiles where Query likein $mymsg ">
<tr><td>$id</td><td>$Query</td> </tr>
</SQL>
</TABLE>

<hr>

<profiler GET $mymsg testprofile >
<$mymsg = $ret>
<sum "%s" "select id,Query from profiles where Query likein '" $ret "'">
<TABLE border=1>
<tr><th>Returned by Profiler</th><td>$mymsg</td>
<tr><th>Text to match </th><td>$mymsg</td>
<tr><th>Command</th><td>$ret</td></tr>
</TABLE>

<TABLE border=1>
<tr><th>id</th><th>Query</th></tr>
<!-- SQL $ret -->
<SQL "select id,Query from profiles where Query likein $mymsg ">
<tr><td>$id</td><td>$Query</td> </tr>
</SQL>
</TABLE>
</a>

The first part which use likein but not against result from profiler will be fine but the

<profiler GET $mymsg >

does not return anything at all. In turn, I can not get any result from second sql.

My profile table have two relevent entries with Query as:

kernel
Linux distribution kernel

I assume this is a ready-to-use feature. What I missed
here. Do I need to turn certain sqlcp or apicp option on or off?

I know that I need do this for the first part to work:

<apicp allinear true>

Any help is appreciated.

Wenlai
User avatar
John
Site Admin
Posts: 2597
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

profiler GET

Post by John »

Is your metamorph counter index up to date? The index does need to be current for the profiler GET function to work correctly. It can be brought up to date by re-issuing the create index statement.
John Turnbull
Thunderstone Software
wtian
Posts: 11
Joined: Thu Apr 05, 2001 3:23 pm

profiler GET

Post by wtian »

Thanks, John. It worked after I reindex the profile table.

Does this mean all index need to keep up to date through command (or user program)? I mean, the
DBMS will not keep index updated automaticly? Do I have
that option if I keep the server running?

Also, will new queries get picked up just by reindex the profile table if the profiler had been initialized and running? In other words, do I also need to re-initialize the profiler after I insert a query and reindex the profile table?

Thanks again.
User avatar
John
Site Admin
Posts: 2597
Joined: Mon Apr 24, 2000 3:18 pm
Location: Cleveland, OH
Contact:

profiler GET

Post by John »

You might want to adjust the SYSMETAINDEX settings so that the index is automatically updated more frequently, e.g.

INSERT INTO SYSMETAINDEX VALUES('INDEXNAME', 60, 1);

Other common alternatives are to update the index after modifying the table, or before processing a batch of records, depending on the application.

The profiler does not need to be reinitialized after updating the index.
John Turnbull
Thunderstone Software
wtian
Posts: 11
Joined: Thu Apr 05, 2001 3:23 pm

profiler GET

Post by wtian »

Thanks for the pointer. It is good to know that I do not need to reinitialize the profiler. It can be quite expensive.

One more question. This may be a little off-topic. But talking about expensive, is the deamon controlled index update different from index by re-issuing the create index statement? Are they incremental? If so, how will it affect the query performance (or not) ?
john27
Posts: 1
Joined: Fri Jun 09, 2000 10:52 am

profiler GET

Post by john27 »

The index update operation is the same whether done by the daemon or done manually. Both are incremental. The only difference is the daemon checks to see if the update should happen.
Post Reply