I've been reading the  Books Online article.  It states:     FAST_FORWARD:    Specifies a FORWARD_ONLY, READ_ONLY cursor with performance optimizations enabled.   and      FORWARD_ONLY:   Specifies that the cursor can only be scrolled from the first to the last row. FETCH NEXT is the only supported fetch option. If FORWARD_ONLY is specified without the STATIC, KEYSET, or DYNAMIC keywords, the cursor operates as a DYNAMIC cursor.    Does this mean that a FAST_FORWARD cursor is a DYNAMIC cursor by default, unless I also specify that it's STATIC?
121748
I'm running into a performance problem with a query that I can't seem to get my head around.  I pulled the query out of a cursor definition.  This query takes seconds to execute  SELECT A.JOBTYPE FROM PRODROUTEJOB A WHERE ((A.DATAAREAID=N'IW') AND ((A.CALCTIMEHOURS&lt;&gt;0) AND (A.JOBTYPE&lt;&gt;3))) AND EXISTS (SELECT 'X' FROM PRODROUTE B WHERE ((B.DATAAREAID=N'IW') AND (((((B.PRODID=A.PRODID) AND ((B.PROPERTYID=N'PR1526157') OR (B.PRODID=N'PR1526157'))) AND (B.OPRNUM=A.OPRNUM)) AND (B.OPRPRIORITY=A.OPRPRIORITY)) AND (B.OPRID=N'GRIJZEN'))) AND NOT EXISTS (SELECT 'X' FROM ADUSHOPFLOORROUTE C WHERE ((C.DATAAREAID=N'IW') AND ((((((C.WRKCTRID=A.WRKCTRID) AND (C.PRODID=B.PRODID)) AND (C.OPRID=B.OPRID)) AND (C.JOBTYPE=A.JOBTYPE)) AND (C.FROMDATE&gt;{TS '1900-01-01 00:00:00.000'})) AND ((C.TODATE={TS '1900-01-01 00:00:00.000'})))))) GROUP BY A.JOBTYPE ORDER BY A.JOBTYPE   The actual execution plan looks like this.    Noticing the server wide setting was set to MaxDOP 1 I tried playing around with maxdop settings.  Adding OPTION (MAXDOP 0) to the query, or changing the server settings results in much better performance and this query plan.    However, the application in question (Dynamics AX) doesn't execute queries like this, it uses cursors.  The actual code captured is this.  declare @p1 int set @p1=189527589 declare @p3 int set @p3=16 declare @p4 int set @p4=1 declare @p5 int set @p5=2 exec sp_cursoropen @p1 output,N'SELECT A.JOBTYPE FROM PRODROUTEJOB A WHERE ((A.DATAAREAID=N''IW'') AND ((A.CALCTIMEHOURS&lt;&gt;0) AND (A.JOBTYPE&lt;&gt;3))) AND EXISTS (SELECT ''X'' FROM PRODROUTE B WHERE ((B.DATAAREAID=N''IW'') AND (((((B.PRODID=A.PRODID) AND ((B.PROPERTYID=N''PR1526157'') OR (B.PRODID=N''PR1526157''))) AND (B.OPRNUM=A.OPRNUM)) AND (B.OPRPRIORITY=A.OPRPRIORITY)) AND (B.OPRID=N''GRIJZEN''))) AND NOT EXISTS (SELECT ''X'' FROM ADUSHOPFLOORROUTE C WHERE ((C.DATAAREAID=N''IW'') AND ((((((C.WRKCTRID=A.WRKCTRID) AND (C.PRODID=B.PRODID)) AND (C.OPRID=B.OPRID)) AND (C.JOBTYPE=A.JOBTYPE)) AND (C.FROMDATE&gt;{TS ''1900-01-01 00:00:00.000''})) AND ((C.TODATE={TS ''1900-01-01 00:00:00.000''})))))) GROUP BY A.JOBTYPE ORDER BY A.JOBTYPE ',@p3 output,@p4 output,@p5 output select @p1, @p3, @p4, @p5   resulting in this execution plan (and unfortunately the same multiple-second execution times).    I've tried several things such as dropping cached plans, adding options in the query inside the cursor definition, ... But none of them seem to get me a parallel plan.  I've also searched google for quite a bit looking for parallelism limitations of cursors but can't seem to find any limitations.  Am I missing something obvious here?  The actual SQL build is SQL Server 2008 (SP1) - 10.0.2573.0 (X64) which i realise is unsupported, but I cannot upgrade this instance as I see fit. I would need to transfer the database to another server and that would mean pulling a fairly large uncompressed backup over a slow WAN.  Trace flag 4199 doesn't make a difference, and neither does OPTION (RECOMPILE).  The cursor properties are:   API | Fast_Forward | Read Only | Global (0)
54561
In PostgreSQL, I use the now() and current_timestamp function and I see no difference:  # SELECT now(), current_timestamp;               now               |              now                --------------------------------+--------------------------------  04/20/2014 19:44:27.215557 EDT | 04/20/2014 19:44:27.215557 EDT (1 row)   Am I missing something?
23741
states:  "In practice, explicit right outer joins are rarely used, since they can always be replaced with left outer joins and provide no additional functionality."  Can anyone provide a situation where they have preferred to use the RIGHT notation, and why? I can't think of a reason to ever use it. To me, it wouldn't ever make things more clear.  Edit: I'm an Oracle veteran making the New Year's Resolution to wean myself from the (+) syntax. I want to do it right
103055
Please look at this code:  create table #t1(   id int identity (1,1),   val varchar(10) );   insert into #t1 values ('a'); insert into #t1 values ('b'); insert into #t1 values ('c'); insert into #t1 values ('d');   Now, whenever you execute this  select *,      ( select top 1 val from #t1 order by NEWID()) rnd  from #t1 order by 1;   you will get a result with where all rows have the same random value. e.g.  id          val        rnd ----------- ---------- ---------- 1           a          b 2           b          b 3           c          b 4           d          b   I know a way using a cursor to loop throw the rows and get different random values, but that is not performant.   A clever solution to this is   select t1.id, t1.val, t2.val from #t1 t1     join (select *, ROW_NUMBER() over( order by NEWID()) lfd from #t1) as t2 on  t1.id = t2.lfd    But I simplified the query. The real query looks more like  select *,      ( select top 1 val from t2 where t2.x &lt;&gt; t1.y order by NEWID()) rnd  from t1 order by 1;   and the simple solution doesn't fit. I'm looking for a way to force repeated evaluation of  ( select top 1 val from #t1 order by NEWID()) rnd    without the use of cursors.  Edit: Wanted output:  perhaps 1 call  id          val        rnd ----------- ---------- ---------- 1           a          c 2           b          c 3           c          b 4           d          a   and a second call  id          val        rnd ----------- ---------- ---------- 1           a          a 2           b          d 3           c          d 4           d          b   The value for each row just should be a random value independent from the other rows  Here is the cursor version of the code:  CREATE TABLE #res ( id INT, val VARCHAR(10), rnd VARCHAR(10));  DECLARE @id INT DECLARE @val VARCHAR(10) DECLARE c CURSOR FOR SELECT id, val FROM #t1 OPEN c FETCH NEXT FROM c INTO @id, @val WHILE @@FETCH_STATUS = 0 BEGIN     INSERT INTO #res     SELECT @id, @val, ( SELECT TOP 1 val FROM #t1 ORDER BY NEWID()) rnd      FETCH NEXT FROM c INTO @id, @val END CLOSE c DEALLOCATE c  SELECT * FROM #res
46689
I'm reading source code of the linux tool . They use the read() function there. Is there a difference to the standard C fread() function? (I'm not counting the arguments as a difference.)
108578
I am a Windows user and coming from Windows with all the indexing and eternal wait times when searching for files, I find it surprising how fast does locate work or the autocompletion (that I know) work in linux.  Is there any indexing being done in the background or how is this achieved? I still have a pretty clean installation, so maybe this goes bad with time, but in Windows the moment you want to search on a folder which is not indexed you have to wait for some seconds.
32352
I saw this keyword for the first time and I was wondering if someone could explain to me what it does.   What is the continue keyword? How does it work? When is it used?
38685
So I've read a few times about this, the “moving arguments” and all that. But what does it really mean? Could someone explain in a few words what is going on at the TeX level, what is the difference between these two kinds of commands? Furthermore, when do we need to use \protect and why?
34074
Why this code isn't working? In my mind the next() method should move the cursor for the next item of the list...  List&lt;string&gt; listX = new List&lt;String&gt; {'A','B','C'}; while(listX.iterator().hasNext())     system.debug(listX.iterator().next());   When I try to run it I receive a error message of exceed a governor limit of CPU time. It's happend because the next() method doesn't move the cursor for the next list item. Every time returns "A".
36590
I want to find, say, 10 most common word in a text file. Firstly, solution should be optimized for keystrokes (in other words - my time). Secondly, for the performance. Here is what I have so far to get top 10:  cat test.txt | tr -c '[:alnum:]' '[\n*]' | uniq -c | sort -nr | head  -10   6 k   2 g   2 e   2 a   1 r   1 k22   1 k   1 f   1 eeeeeeeeeeeeeeeeeeeee   1 d   I could make a java, python etc. program where I store (word, numberOfOccurences) in a dictionary and sort the value or I could use MapReduce, but I optimize for keystrokes.   Are there any false positives? Is there a better way?
6062
My cursor is moving by every selection by large increments!  Normally when I use Blender, I am able to select and move objects to any coordinate. Now, all of the sudden, when I select an object or mesh the selection moves by an inch or so in each direction.  How do I reset it to normal?
111946
For a presentation I am making, I want to find my Mac's system's default "Spinning Wait Cursor" resources.  I was  that  are in here:     /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/HiServices.framework/Versions/A/Resources/cursors  and :     /System/Library/Frameworks/WebKit.framework/Versions/Current/Frameworks/WebCore.framework/Resources/  Indeed, one can find some large and vectorized versions of most cursors in the first folder, and some other, smaller ones in the second.  But, there seems to be no beach ball in there.   I know one can find the graphics in high resolution online easily, but for my project I would need to get the original system files.  A screenshot or animated screenshot also wouldn't be what I'm looking for. I couldn't find the info anywhere.  Note 1: From the GUI, a user can see the spinning wait cursor in various different sizes depending on the settings in System Preferences > Accessibility > Display > Cursor size, and then proceeding to crash their computer.  Note2: I am not trying to change my OS' appearance.  Can anyone help me find where the resource is?  Is it ?
10864
I was wondering how to implement time travel into a game. Nothing super complex, just time-reversal like what's in Braid, where the user can rewind/fast forward time by 30 seconds or whatever.  I searched around the web a lot, but my results usually referred to using time as in like "it's 3:00" or a timer and such.  The only thing I could think of was using 2 arrays, one for the player's x position and the other for the player's y position, and then iterating through those arrays and placing the character at that position as they rewind/fast forward time. Could that work? If it would work, how large would the array have to be and how often should I store the player's x and y? If it doesn't work, what else could I try?  Thanks in advance!
29746
Per the kernel documentation:  This control is used to define how aggressive the kernel will swap memory pages.  Higher values will increase aggressiveness, lower values decrease the amount of swap.   However this is kind of vague. I'm trying to figure out exactly what the parameter ultimately controls. I know it adjusts how aggressively the kernel tries to swap out pages, but what decision making process in the kernel code does it affect?  Does it adjust how long ago a page must have been accessed before the kernel swaps it out? If so what does the default value of 60 represent? And how much is changed by a increment/decrement of 1 (a formula would be nice)? Or does it swap out pages based on their access frequency? Or something else?
62736
In unix/linux, any number of consecutive forwardslashes in a path is generally equivalent to a single forwardslash. eg.  $ cd /home/shum $ pwd /home/shum $ cd /home//shum $ pwd /home/shum $ cd /home///shum $ pwd /home/shum   Yet for some reason two forwardslashes at the beginning of an absolute path is treated specially. eg.  $ cd ////home $ pwd /home $ cd /// $ pwd / $ cd // $ pwd // $ cd home//shum $ pwd //home/shum   Any other number of consecutive forwardslashes anywhere else in a patch gets truncated, but two at the beginning will remain, even if you then navigate around the filesystem relative to it.  Why is this? Is there any difference between /... and //... ?
61097
I am using TeXShop 3.26 under Mavericks. I have SyncTeX selected as the sync method. Searching works both ways in general (source to pdf and pdf to source). However, when editing a multifile source where there is a "root" document with sections included with \input{}, and similarly subsections within those, forward search (source to PDF) doesn't work. Nothing happens. PDF to source still works fine.  Is this known/expected behaviour? Is there any setting I can make to fix it?
24113
What's the point of the touch command? I know I can create empty files with it, but so is also the case with echo -n.  Otherwise, why would someone need to change the timestamps of a file? Unless to create the false impression about the age of a file, I don't see any other use, and this one is not a legitimate one (from my point of view).