What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 134 Stack Exchange communities.

I am trying to update my answer http://stackoverflow.com/a/11773840/619960 with some extra code and text and I keep getting 2 possible outcomes:

  • The orange error box pops up "An error occurred saving ..."
  • The little progress dots just stop pulsing and nothing happens.

In the mean time I saved the updated text here: https://gist.github.com/3235674

I tested updating in the following browsers:

  • Google Chrome 20.0.1132.42 m
  • Internet Explorer 8.0.7601.17514

In both browsers the same problems occur.

The following call failed

Request URL:http://stackoverflow.com/posts/11773840/edit-submit/b1f364b1-280f-4115-8a8a-3e38f730fdfd

Request Headers:
  POST http://stackoverflow.com/posts/11773840/edit-submit/b1f364b1-280f-4115-8a8a-3e38f730fdfd HTTP/1.1
  Origin: http://stackoverflow.com
  X-Requested-With: XMLHttpRequest
  User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/536.11 (KHTML, like Gecko) Chrome/20.0.1132.47 Safari/536.11
  Content-Type: application/x-www-form-urlencoded
  Accept: application/json, text/javascript, */*; q=0.01
  Referer: http://stackoverflow.com/questions/11771716/tsql-very-optimized-udf/11773840

Form Data: 
  is-current:true
  post-text:Performance+of+scalar+functions+is+usually+not+very+good%2C+to+do+what+you+ask+I+would+write+it+as+a+table+valued+function.+A+table+valued+function+has+the+benefit+that+it+is+inlined+properly.+%0D%0A%0D%0AOther+forms+of+the+query+will+not+make+a+huge+difference+as+it+is+the+calls+to+the+function+which+eat+up+the+time.+%0D%0A%0D%0A++++CREATE+FUNCTION+dbo.fn_age(%40birthdate+datetime%2C+%40current_date+datetime)%0D%0A++++RETURNS+TABLE%0D%0A++++WITH+SCHEMABINDING%0D%0A++++AS%0D%0A++++return+(%0D%0A++++SELECT+cast((DATEPART(year%2C+%40current_date+-+%40birthdate))+-+1900+as+varchar(4))+%2B+'y+'+%0D%0A+++++++++%2B+cast(DATEPART(month%2C+%40current_date+-+%40birthdate)+as+varchar(2))+%2B+'m'+%0D%0A+++++++++%2B+cast(DATEPART(day%2C+%40current_date+-+%40birthdate)+as+varchar(2))+%2B+'d'++as+%5BAge%5D%0D%0A++++)%0D%0A++++GO%0D%0A%0D%0AThis+function+has+to+be+called+like+this%3A%0D%0A%0D%0A++++SELECT+Age+%3D+(SELECT+Age+FROM+dbo.fn_age(birthDate%2C+current_timestamp))%0D%0A++++FROM+Person%0D%0A%0D%0AComparison+with+other+alternatives%0D%0A%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%0D%0A%0D%0AWhen+writing+this+problem+as+a+normal+scalar+function+I+would+create+something+like+this%3A%0D%0A%0D%0A++++CREATE+FUNCTION+dbo.fn_age_slow(%40birthdate+datetime%2C+%40current_date+datetime+)%0D%0A++++RETURNS+VARCHAR(10)%0D%0A++++WITH+SCHEMABINDING%0D%0A++++AS%0D%0A++++begin%0D%0A++++return+cast((DATEPART(year%2C+%40current_date+-+%40birthdate)+-+1900)+as+varchar(4))+%2B+'y+'+%0D%0A+++++++++%2B+cast(DATEPART(month%2C+%40current_date+-+%40birthdate)+as+varchar(2))+%2B+'m'+%0D%0A+++++++++%2B+cast(DATEPART(day%2C+%40current_date+-+%40birthdate)+as+varchar(2))+%2B+'d'+%0D%0A++++end%0D%0A++++GO%0D%0A%0D%0AAs+you+can+see+it+does+exactly+the+same+as+the+table+valued+function.+(it+is+also+schema+bound+which+makes+the+functions+faster+in+some+cases)%0D%0A%0D%0AWhen+running+the+following+script+against+the+first+function+(on+my+pc)%0D%0A%0D%0A++++declare+%40a+varchar(10)+%3D+''%0D%0A++++++++++%2C+%40d+datetime+%3D+'20120101'%0D%0A++++++++++%2C+%40i+int+%3D+1%0D%0A++++++++++%2C+%40begin+datetime%0D%0A++++%0D%0A++++select+%40begin+%3D+CURRENT_TIMESTAMP%0D%0A++++while+%40i+%3C+1000000%0D%0A++++++begin%0D%0A++++++++select+%40a+%3D+Age+%0D%0A+++++++++++++%2C+%40d+%3D+%40begin+-+%40i%251000+%0D%0A+++++++++++++%2C+%40i+%2B%3D+1%0D%0A++++++++++from+dbo.fn_age5(%40d%2C+%40begin)%0D%0A++++++end%0D%0A++++%0D%0A++++select+CURRENT_TIMESTAMP+-+%40begin+%0D%0A++++GO%0D%0A%0D%0A**%3D%3D%3E+00%3A00%3A04.703**%0D%0A%0D%0A%0D%0A++++declare+%40a+varchar(10)+%3D+''%0D%0A++++++++++%2C+%40d+datetime+%3D+'19500101'%0D%0A++++++++++%2C+%40i+int+%3D+1%0D%0A++++++++++%2C+%40begin+datetime%0D%0A++++%0D%0A++++select+%40begin+%3D+CURRENT_TIMESTAMP%0D%0A++++while+%40i+%3C+1000000%0D%0A++++++begin%0D%0A++++++++select+%40a+%3D+dbo.fn_age_slow(%40d%2C+%40begin)+%0D%0A+++++++++++++%2C+%40d+%3D+%40begin+-+%40i%251000+%0D%0A+++++++++++++%2C+%40i+%2B%3D+1%0D%0A++++++end%0D%0A++++%0D%0A++++select+CURRENT_TIMESTAMP+-+%40begin%0D%0A%0D%0A**%3D%3D%3E+00%3A00%3A10.310**%0D%0A%0D%0A%0D%0AThis+is+in+no+way+a+proper+benchmark+but+it+should+give+you+an+idea+about+the+performance+difference.
fkey:48a74df9332ea88d2f79e83bae7545ba
share|improve this question
    
I replaced the old text with the github gist without problems. Probably a browser issue? –  Daniel Fischer Aug 2 '12 at 12:56
    
I had the same issue yesterday on another question and tried the update like 20 times. It eventually worked a few hours later. –  Filip De Vos Aug 2 '12 at 13:03
    
Sounds like it's your connection, or proxies? –  Daniel Fischer Aug 2 '12 at 13:06
    
How come I can comment no problem and create a question here? (I actually tried to edit at least 10 times since this morning) –  Filip De Vos Aug 2 '12 at 13:07
    
A matter of size? But I'm just guessing wild, as far as I know, the internet is a series of tubes. –  Daniel Fischer Aug 2 '12 at 13:09
    
My post here contains the full edit (in post-text). So size is not the issue. –  Filip De Vos Aug 2 '12 at 13:10
    
Hmm, yeah, right, so... I have no clue, sorry. –  Daniel Fischer Aug 2 '12 at 13:14
4  
Very strange, this is most definitely a problem on our end. Note that I have force-logged you out, since you posted your XSRF token here. You'll have to log in back to Stack Overflow. –  balpha Aug 2 '12 at 13:17
    
Thanks, you can tell I'm not a web developer :p –  Filip De Vos Aug 2 '12 at 13:21
    
No worries, you're not the first who does something like this :) –  balpha Aug 2 '12 at 13:24
    
@balpha Happened again today, this time editing a question. –  Filip De Vos Aug 3 '12 at 14:44

You must log in to answer this question.

Browse other questions tagged .