Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.databases.ms-sqlserver    |    Notorious Rube Goldberg contraption    |    19,505 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 17,789 of 19,505    |
|    Gert-Jan Strik to Emin    |
|    Re: Why does adding a where clause make     |
|    13 Apr 10 18:16:04    |
      4308283b       From: sorrytoomuchspamalready@xs4all.nl              Emin,              The key is in the parts that you don't tell us, or only tell us in a       side note.              For example, there is a big difference between the statement               SELECT X FROM A WHERE X=1              and               SELECT * FROM A WHERE X=1 AND Y=2              The difference between these two is not just the extra predicate in the       WHERE clause, but also the column list of the resultset. The first can       be satisfied with just an index on X. The second requires all columns       and (probably) cannot be satisfied with a nonclustered index on X.              You mention that "A" is not a table, but the result of a table valued       function. That makes a big difference. TVFs do not have indexes. Only       tables do (and your occasional indexed view).              So without seeing the true query, and knowing more about the tables and       indexes that are in play, I don't think it is possible to answer your       question.              --       Gert-Jan                     Emin wrote:       >       > One more strange effect:       >       > If I do       > SELECT * FROM A WHERE X=1 AND Y=2       > OPTION (FORCE ORDER)       > then things only take 5 times as long as SELECT * FROM A WHERE X=1       > which is annoying but at least it runs.       >       > But if I do       > SELECT * FROM A WHERE X=1 AND Y=2       > OPTION (FAST 5)       > then it runs super fast.       >       > Could someone explain what the FAST option does?       >       > [Note that A is a table-valued function in this case]       >       > Thanks again,       > -Emin       >       > On Apr 13, 9:08 am, Emin |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca