I have a view that (left outer) joins multiple recursive CTEs. There are about 10k rows. The results of running SELECT * FROM MyView ORDER BY MyPrimaryKey, with statistics time and io on:   SQL Server Execution Times:    CPU time = 0 ms,  elapsed time = 0 ms.  (11063 row(s) affected) Table 'Worktable'. Scan count 49743, logical reads 296781, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. Table 'MyTableA'. Scan count 7, logical reads 23690, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. Table 'MyTableB'. Scan count 18832, logical reads 38207, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. Table 'MyTableC'. Scan count 6, logical reads 5458, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. Table 'MyTableD'. Scan count 2, logical reads 112, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. Table 'MyTableE'. Scan count 2, logical reads 184, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.   SQL Server Execution Times:    CPU time = 688 ms,  elapsed time = 881 ms.   The results of SELECT TOP 25 * FROM MyView ORDER BY MyPrimaryKey:   SQL Server Execution Times:    CPU time = 0 ms,  elapsed time = 0 ms.  (25 row(s) affected) Table 'Worktable'. Scan count 48353, logical reads 801727, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. Table 'Worktable'. Scan count 0, logical reads 0, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. Table 'MyTableB'. Scan count 9360, logical reads 20006, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. Table 'MyTableA'. Scan count 4, logical reads 7359, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. Table 'MyTableD'. Scan count 1, logical reads 17944, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. Table 'MyTableE'. Scan count 2, logical reads 184, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0. Table 'MyTableC'. Scan count 5, logical reads 226, physical reads 0, read-ahead reads 0, lob logical reads 0, lob physical reads 0, lob read-ahead reads 0.   SQL Server Execution Times:    CPU time = 29765 ms,  elapsed time = 30865 ms.   Why on earth are the execution times so drastically different?
For a moderately complex query I am trying to optimize, I noticed that removing the TOP n clause changes the execution plan.  I would have guessed that when a query includes TOP n the database engine would run the query ignoring the the TOP clause, and then at the end just shrink that result set down to the n number of rows that was requested.  The graphical execution plan seems to indicate this is the case -- TOP is the "last" step.  But it appears there is more going on.  My question is, how (and why) does a TOP n clause impact the execution plan of a query?  Here is a simplified version of what is going on in my case:  The query is matching rows from two tables, A and B.    Without the TOP clause, the optimizer estimates there will be 19k rows from table A and 46k rows from table B.  The actual number of rows returned is 16k for A and 13k for B.  A hash match is used to join these two results sets for a total of 69 rows (then a sort is applied).  This query happens very quickly.  When I add TOP 1001 the optimizer does not use a hash match; instead it first sorts the results from table A (same estimate/actual of 19k/16k) and does a nested loop against table B.  The estimated number of rows for table B is now 1, and the strange thing is that the TOP n directly affects the estimated number of executions (index seek) against B -- it appears to always be 2n+1, or in my case 2003.  This estimate changes accordingly if I change TOP n.  Of course, since this is a nested join the actual number of executions is 16k (the number of rows from table A) and this slows down the query.  The actual scenario is a bit more complex but this captures the basic idea/behavior.  Both tables are searched using index seeks.  This is SQL Server 2008 R2 Enterprise edition.
The value of $\lim_{n \to \infty}\int_{0}^{1}nx^ne^{x^2}dx$ Email searches in Outlook 2013 work as expected. I am trying to refine it by excluding certain folders by default. I was hoping I could uncheck certain folders in Control Panel > Indexing Options > Outlook. Unfortunately, the checkbox is for Outlook itself. I can either search Outlook or not. There is no refinement beyond that. Is there another way to exclude searching of specific folders? You can also contact me to customize your template, or create a new unique one.   Do I need to put a comma between the new and unique adjectives in this sentence?  In my native language (if I am not mistaken) we don't put a comma if the adjectives are of a different type. Not sure about English though, and if it's the case here anyway. Any help would be appreciated! Activate Field Service Lightning feature in a Salesforce DX scratch org? I am struggling to figure out how to -- or if it's even possible to -- create a DX scratch org with the "Field Service Lightning" (FSL) feature installed. Based on the feature list  I'm guessing the answer is no and I'll just have to wait. But I'm not sure I'm interpreting that source correctly or missing something entirely since I'm just wrapping my head around DX.   Background: we have a production org with FSL installed and active, along with it's accompanying managed packages. I can create sandboxes from it and do development using standard Metadata API tools, but I was hoping to start a new project using DX. But I'm stuck configuring a scratch org with the proper features. Why is the observable universe so big? The observable universe is approximately 13.7 billion years old. But yet it is 80 billion light years across. Isn't this a contradiction? Access denied when creating keystore for Android app Light emission from the vicinity of a black hole The photograph of the black hole, at the centre of galaxy M87, is now a part of human history. We are told that the red-colour is caused by hot gas, matter &amp; radiation around the "edge", the Event Horizon. Given the power of the gravitational forces emanating from black hole, why aren't these three things drawn into the abyss? If light is bent/ drawn into the BH, how does this red image arise? The logic, here, would be that a body, on the Event Horizon, is immune from the gravity--which sounds pretty fatuous? Clip tool gives ERROR 000732? What is the difference between '/' and '//' when used for division? Bogus float inequality due to compiler optimization? I want to prove  \begin{equation*} \tan A  + \tan B + \tan C = \tan A\tan B\tan C \quad\text{when } A+B+C = 180^\circ \end{equation*}  We know that   \begin{equation*} \tan(A+B) = \frac{\tan A+\tan B}{1-\tan A\tan B}~\text{and that}~A+B = 180^\circ-C. \end{equation*}  Therefore $\tan(A+B) = -\tan C.$ From here, I get stuck. Please help. $a,b,c$ are distinct real numbers that $$(a^2)(1-b+c)+(b^2)(1-c+a)+(c^2)(1-a+b)=ab+bc+ca.$$ Prove $$\frac{1}{(a-b)^2}+\frac{1}{(b-c)^2}+\frac{1}{(c-a)^2}=1.$$ I have tried two different approaches to this problem but am stuck.  First I started by expanding the bottom of each fraction. $\frac{1}{(a^2)-2ab+(b^2)}+\frac{1}{(b^2)-2bc+(c^2)}+\frac{1}{(c^2)-2ac+(a^2)}=1$  I also tried to expand $(a^2)(1-b+c)+(b^2)(1-c-a)+(c^2)(1-a+b)=ab+bc+ca$   $(a^2)-(a^2)b+(a^2)c+(b^2)-(b^2)c-(b^2)a+(c^2)-(c^2)a+(c^2)b=ab+bc+ca$ $(a^2)-(a^2)b+(a^2)c+(b^2)-(b^2)c-(b^2)a+(c^2)-(c^2)a+(c^2)b-ab-bc-ca=0$ Then I added one to both sides $(a^2)-(a^2)b+(a^2)c+(b^2)-(b^2)c-(b^2)a+(c^2)-(c^2)a+(c^2)b-ab-bc-ca+1=0+1$ Help will be appreciated. Would a fast interstellar spaceship benefit from an aerodynamic shape? Some (generous) assumptions:   We have a spaceship that can reach a reasonable fraction of light speed. The ship is able to withstand the high energies of matter impacting at that speed.   Given the amount of matter in inter-stellar space, at high speed, would it encounter enough of it and frequently enough that an aerodynamic shape would significantly reduce its drag (and thus save fuel)? As of the November 2018 core book updates, what changes were made in the latest printings of the PHB that aren't noted in the errata document? This is a question that has been addressed several times, not only here, but also in other sites of the stack exchange network (e.g. ). However, I cannot make any of the solutions work for me.  I'm running a command through ssh. Whenever I exit ssh, I want the command to die as well. This command is a daemon called ktserver that runs indefinitely until you press Ctrl-C.  I run it as follows: ssh -t compute-0-1 ktserver and, indeed, when I press Ctrl-C, the process ends gracefully and the ssh session ends.  However, if instead of pressing Ctrl-C, I kill the ssh process using the kill command (for example, sending SIGINT or SIGHUP), the ktserver process stays alive.  How can I make the ktserver always die independent on how ssh is killed?  EDIT: If, instead of ktserver I run something completely different, such as gedit, everything works like a charm (i.e. gedit dies when the connection dies). Therefore, there might be something wrong with the process itself. For example, I thought that it might be ignoring SIGHUP or SIGINT. However, when I run kill -1 ktserver or kill -2 ktserver, the process dies as expected.  EDIT2: As Mark Plotnick points out, the issue is related to the fact that there is no communication circulating on the ssh channel. I've confirmed by running ssh -t &lt;host&gt; read and killing the ssh process afterwards. readwas still alive and kicking. Can't preview smoke simulation on Blender 2.82 Whenever I add a Quick Smoke effect, I can't preview it on the viewport unless I bake it.   And Yes, I added the Smoke Domain on the object.   I've seen tutorials like this  and this  that clearly shows the possibility of previewing the smoke before baking it.   I'm using Blender on a Mac with AMD GPU. I would guess that this is something related to OpenGL, as thoroughly explained here -  but that's for Windows.   Does anyone have any idea how to fix this? Roll a 6-sided die until the total $\geq M$. Mean amount by which $M$ is exceeded? Here is the question:  You roll a fair 6-sided dice iteratively until the sum of the dice rolls is greater than or equal to M. What is the mean and standard deviation of the sum minus M when M=300?  Should I write a code to answer these kind of questions?  Please give me some hints on that. thanks! How can I create launcher icon for PhpStorm? Will this schematic work as a four-bit shift register? &ndash; Schematic created using   Will this work as a four-bit shift register? (And by extension a shift register of any size?) Each vertical PMOS / NMOS transistor pair acts as a multiplexer, and the PMOS transistor to its left amplifies the voltage back up to close to V_high. I'd be interested in hearing people's feedback on this. Right now I have only three transistors (and a resistor) per bit. Can I really get it that small a ratio, or are there reasons why I need more transistors per bit?  It's probably worth noting that I don't have master/slave here, so I can only assert (Shift) long enough to move one bit toward the right and no more.  Furthermore, I'm not trying to say that I need a resistor with 100 ohms. That appeared to be the only resistor I could use to make this schematic! What I want is a resistor that has significantly less resistance than the PMOS it's next to when it's at high impedance, but enough resistance to prevent a short circuit from V_high to ground when that transistor is conducting.  Okay, now I've changed each of the BJT's to MOSFET's, and reduced the resistance of each resistor from 100 ohms to 10 ohms. I'm still going on the assumption that (shift) will only be asserted long enough for the gate delays of M4 and M5, and then of M6, so the value of (dataIn) will only make it to M6's output, and won't move to M8 until the next time (shift) is asserted. Is this enough to get this circuit behaving like a four-bit shift register? How to mount a virtual hard disk? Is it possible to mount a virtual hard disk (VHD, HDD, VDI, VMDK) on Ubuntu? How can this be done?