Re: SQL Humor



Hugo Kornelis wrote:
On 18 Aug 2005 15:13:28 -0700, Mikito Harakiri wrote:


Hugo Kornelis wrote:

On 18 Aug 2005 13:17:37 -0700, Mikito Harakiri wrote:

pondering if

select * from table

is faster than

select col1, col2, ... from table

No need to ponder that -- all SQL Server DBAs (and presumably all DBAs for all serious RDBMS's) know that SELECT * should never be used in production code (except in a EXISTS(..) subquery).

My bad. I meant

select count(1) from table

vs.

select count(*) from table


Hi Mikito,

As Mike said: absolutely no difference between the two.



BTW, you triggered the other example: is EXISTS or IN faster? This
question could come up only from somebody who is completely unaware of
SQL expression equivalency and query rewrite.


SQL Server will often produce the same execution for both versions. If
performance is really critical, always test all versions. If performance
is important but not criticat, use EXISTS - I've seen cases where it's
faster than IN, but I haven't seen the reverse yet.



Well, making sure the
extents and segments are layed out on disk properly, leaves little room
for education and abstract thinking.


Huh? I don't know what your DMBS of choice is, but SQL Server doesn't
bother the DBA with extents and segments.

Best, Hugo


i don't mean to single anybody out, but much of the talk lately has been about domains and syntax of domains. in spite of the many messages about 'equality', i get the impression that very few people take the minimalist view that i do which is that the RM only gets confused by these questions. and that for some of us, the confusion is never-ending if they are entertained. 'equality', if you will, is fundamentally a point-of-view, from the RM's perspective. it just seems to me that the RM becoms simpler (a possible advantage being simpler implementation) if questions about reality are kept out of it. obviously, when i say 'keep reality out of it', many people will start flaming about 'what good is it then?', but i'll try to ignore them as i attempt to understand the 'theory'. the big questions for the RM, *for me* seem to include view updatability which has to do with the operators of the algebra as well as whether a relational engine can implement customary features such as concurrency control and presentation coherence without being written in a language that eschews the relational operators.

thanks again for listening to my rant!

pc
.



Relevant Pages

  • Re: Help with missing data in query
    ... I did go to that site But I couldn't figure out how to upload anything. ... GROUP BY m.MonthName WITH ROLLUP ... Hugo Kornelis, SQL Server MVP ...
    (microsoft.public.sqlserver.mseq)
  • Re: How to Gnerate a Random ID Number
    ... formula with a seed as input to get at a pseudo-random value?) ... that definitely rules out newid() as a "good" pseudo random number ... this on SQL Server 2005, and the seed does not seem to be reset (or at ... Hugo Kornelis, SQL Server MVP ...
    (comp.databases.ms-sqlserver)
  • Re: Not passing back values on an if statement
    ... Hugo Kornelis wrote: ... SQL Server has to check not only that a row ... > column Application doesn't allow NULLs, ... This email account is my spam trap so I ...
    (microsoft.public.sqlserver.programming)
  • Re: mssql: insert into syntax
    ... Hugo Kornelis writes: ... > Your mention of preserving order when rows are deleted makes me think ... INSERT tbl ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ...
    (comp.databases.ms-sqlserver)