If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > View select slow first time then fast

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-01-03, 17:13
jwain jwain is offline
Registered User
 
Join Date: Aug 2003
Location: Allentown pa
Posts: 41
View select slow first time then fast

Hello,

I have a question. I hope someone can help. We do the following with a view.

CREATE VIEW serv_authcodes AS
SELECT DISTINCT account, btn, npanxx, prodcode, servclass, feeschedidx,

acctcodeflag
FROM servdef
WHERE prodcode in (NULL, '', 'DIALR', 'TRAVL','HOTLN', 'PWFAX',
'DEBIT') and access LIKE '000%' and
canceldate > TODAY

The first time a user runs the report we have a timeout. After the first select that errors all other users reports are fine. If I do a simple select through dbaccess and the user runs the report for the first time it works fine. If no one runs the report for a hour we run into the situation again on the first select. Any Idea's?

Thanks
Jeff
__________________
Jeff Wain
Reply With Quote
  #2 (permalink)  
Old 10-02-03, 19:47
ghed ghed is offline
Registered User
 
Join Date: Nov 2002
Posts: 11
Informix caches the data in the memory, which is why it's faster the 2nd time around. It goes to the Least Recently Used portion when nobody uses the data set for a while... then later on it is released from memory, making space for new recently executed queries.
Reply With Quote
  #3 (permalink)  
Old 10-03-03, 09:04
jwain jwain is offline
Registered User
 
Join Date: Aug 2003
Location: Allentown pa
Posts: 41
Thanks what I did in the short term is simply have a script running to select every min. Is there any other way to force the data to stay in memory
__________________
Jeff Wain
Reply With Quote
  #4 (permalink)  
Old 10-03-03, 16:25
fprose fprose is offline
Registered User
 
Join Date: Apr 2003
Location: Phoenix, AZ
Posts: 177
You might look at the explain output of running this query and determine what the select goes through to satisfy the query. I suspect the LIKE and/or the "> TODAY" are causing table scans of (perhaps) a large table?

If this is the case you need to look at either applying some indexes that would help the query or rewriting the query to use a different approach.

Is this data static during the day? Create a summary table that you query.

Do you need the wildcard - that's USUALLY a killer.
__________________
Fred Prose
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On