Re: SELECT * vs SELECT col1, col2



Serge Rielau (srielau@xxxxxxxxxx) writes:
Uhmm.. I don't think I'd want to confuse the official information schema
with what the DBMS uses for itself. You assume there is neither
compacting of the decomposed information into one object (like a LOB)
nor caching of the schema in memory.

I would guess that SQL Server caches system tables more or less like
either tables. That would at least make most sense to me. DB2 may be
different.

And caching or not, the metadata changes requires a lock. I did this in
one window:

begin transaction
alter table Orders add xyz int null

And in another window I tried to running SELECTs against the Orders table,
and it no difference if I had "SELECT *" or if I selected a small number
of columns. The query blocked.

Again, this may be different in DB2.



--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
.



Relevant Pages

  • Re: SSMS Query Editor... Vs Query Analyser
    ... > 1) If you want to replace a file in the window, ... > CTRL-SHIFT-Delete to clear the window ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (microsoft.public.sqlserver.tools)
  • Re: Kludgy SQL Management Studio behavior
    ... Do you want to include the file in the existing window, ... As for Mgmt Studio in general, there are some nice things, but overall ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (microsoft.public.sqlserver.tools)
  • Re: External Tools - tried to save all my files
    ... sense that it should prompt you to save every window. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxxxxxxx Online for SQL ... Books Online for SQL Server 2000 ...
    (microsoft.public.sqlserver.tools)
  • Re: External Tools - tried to save all my files
    ... sense that it should prompt you to save every window. ... Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx ... Books Online for SQL Server 2005 at ...
    (microsoft.public.sqlserver.tools)
  • Re: Query training -- Complex queries
    ... > Update PositionsEOM ... Here you don't have a derived table, but a correlated subquery. ... UPDATE in Books Online. ... is not written for SQL Server. ...
    (microsoft.public.sqlserver.server)