Re: Multithreading of [replace]

This WebDNA talk-list message is from

1999


It keeps the original formatting.
numero = 23106
interpreted = N
texte = >>Given that I have written a database to do logging of visitors to the website, >>so that I can do my own analysis of who did what, I am running into a problem >>with the sheer number of write commands being issued to this database > >>[search db=carts.db&eqCARTdata=[cart]&DATEtype=date&DATEsort=1&DATEsdir=de] >>[showif [numfound]=0] >>[Append db=carts.db] >>cart=[cart]&date=[date]&firstpage=[thisurl]&lastpage=[thisurl] >>[/append] >>[/showif] >>[showif [numfound]=1] >>[replace db=carts.db&eqCARTdata=[cart]] >>lastpage=[thisurl] >>[/replace] >>[/showif] >>[/search] > >>So, Grant, here is my question: Is there anything that can be optimized that >>will alleviate the speed hit this code causes under load? > >Date searching can be very slow compared to plain text, because WebCatalog >must interpret those dates and calculate lots of stuff. I would re-order >your date text into YYYY/MM/DD order so that it is text-sortable *without* >needing to specify DATEtype=date. I would also set allCase=T so searches >and replaces are case-sensitive (a bit faster). > >Finally, you can get rid of that whole ShowIf thing: unless I misunderstand >your intention, we already put a feature into replace that will append if >not found: [replace db=xx&append=T] will append a new record if none is >found. Hi Brian, Grant may have missed the fact that if you get rid of those showif's and use a straightforward [replace append=t] context, webcat will overwrite your 'firstpage value when it performs a replace. So you would have to modify your replace parameters as I've shown below ...Another suggestion to speed things up, assuming you wish to continue using a search context, would be to remove those date sort parameters. They only slow things down, and you do not need them unless you are displaying results, which you are not.Now that I've made all these comments, I have an even faster solution. The fact of the matter is that you don't need the search context at all. Therefore I would get rid of it completely. You can perform the same tasks shown above with a single replace and a single lookup, like this:[replace append=t&db=carts.db&eqCARTdata=[cart]&allcase=t]cart=[cart]&date=[date %Y/%m/%d]&firstpage=[lookup db=carts.db&value=[cart]&lookinfield=cart&returnfield=firstpage¬found=[thisurl]] ]&lastpage=[thisurl][/replace]Sincerely, Ken Grome Associated Messages, from the most recent to the oldest:

    
  1. Re: Multithreading of [replace] (Kenneth Grome 1999)
  2. Re: Multithreading of [replace] (Christer Olsson 1999)
  3. Re: Multithreading of [replace] (Kenneth Grome 1999)
  4. Re: Multithreading of [replace] (Brian B. Burton 1999)
  5. Re: Multithreading of [replace] (Grant Hulbert 1999)
  6. RE: Multithreading of [replace] (Olin Lagon 1999)
  7. Re: Multithreading of [replace] (Brian B. Burton 1999)
  8. RE: Multithreading of [replace] (Olin Lagon 1999)
  9. Multithreading of [replace] (Brian B. Burton 1999)
>>Given that I have written a database to do logging of visitors to the website, >>so that I can do my own analysis of who did what, I am running into a problem >>with the sheer number of write commands being issued to this database > >>[search db=carts.db&eqCARTdata=[cart]&DATEtype=date&DATEsort=1&DATEsdir=de] >>[showif [numfound]=0] >>[Append db=carts.db] >>cart=[cart]&date=[date]&firstpage=[thisurl]&lastpage=[thisurl] >>[/append] >>[/showif] >>[showif [numfound]=1] >>[replace db=carts.db&eqCARTdata=[cart]] >>lastpage=[thisurl] >>[/replace] >>[/showif] >>[/search] > >>So, Grant, here is my question: Is there anything that can be optimized that >>will alleviate the speed hit this code causes under load? > >Date searching can be very slow compared to plain text, because WebCatalog >must interpret those dates and calculate lots of stuff. I would re-order >your date text into YYYY/MM/DD order so that it is text-sortable *without* >needing to specify DATEtype=date. I would also set allCase=T so searches >and replaces are case-sensitive (a bit faster). > >Finally, you can get rid of that whole ShowIf thing: unless I misunderstand >your intention, we already put a feature into replace that will append if >not found: [replace db=xx&append=T] will append a new record if none is >found. Hi Brian, Grant may have missed the fact that if you get rid of those showif's and use a straightforward [replace append=t] context, webcat will overwrite your 'firstpage value when it performs a replace. So you would have to modify your replace parameters as I've shown below ...Another suggestion to speed things up, assuming you wish to continue using a search context, would be to remove those date sort parameters. They only slow things down, and you do not need them unless you are displaying results, which you are not.Now that I've made all these comments, I have an even faster solution. The fact of the matter is that you don't need the search context at all. Therefore I would get rid of it completely. You can perform the same tasks shown above with a single replace and a single lookup, like this:[replace append=t&db=carts.db&eqCARTdata=[cart]&allcase=t]cart=[cart]&date=[date %Y/%m/%d]&firstpage=[lookup db=carts.db&value=[cart]&lookinfield=cart&returnfield=firstpage¬found=[thisurl]] ]&lastpage=[thisurl][/replace]Sincerely, Ken Grome Kenneth Grome

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

How to verify email address (1997) OPEN MARKET PATENTS SOUND ECOMMERCE ALARM (1998) Admin Edit prob. (1997) EIMS Problems (1997) Online reference (1997) Newbie Tax Question (1997) WebCat2b13MacPlugin - [math][date][/math] problem (1997) Searching multiple fields from one form field (1997) WebCatalog2 Feature Feedback (1996) emailer setup (1997) (1998) Coding Style (2000) using showpage and showcart commands (1996) NT considerations (1997) Version f1 status (1997) Re:Removing items from a cart is wonky... (1998) [Announce]: Web server security and password protection (1997) Uh...can someone help me out with the b10? (1997) Quick source question (2002) Field name-subcategory (1997)