Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: SQL Humor

Re: SQL Humor

From: Hugo Kornelis <hugo_at_pe_NO_rFact.in_SPAM_fo>
Date: Sat, 20 Aug 2005 00:46:35 +0200
Message-ID: <34ocg1tb9qoufmess75bqv8n6bf6s1g7ie@4ax.com>


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

-- 

(Remove _NO_ and _SPAM_ to get my e-mail address)
Received on Fri Aug 19 2005 - 17:46:35 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US