dbTalk Databases Forums  

count(*) ?

comp.databases.oracle.misc comp.databases.oracle.misc


Discuss count(*) ? in the comp.databases.oracle.misc forum.



Reply
 
Thread Tools Display Modes
  #41  
Old   
Frank van Bortel
 
Posts: n/a

Default Re: count(*) ? - 01-17-2008 , 05:03 AM






shakespeare wrote:
Quote:
"Frank van Bortel" <frank.van.bortel (AT) gmail (DOT) com> schreef in bericht
news:ee096$478f27b0$524b5c40$17089 (AT) cache3 (DOT) tilbu1.nb.home.nl...
shakespeare wrote:
"Frank van Bortel" <frank.van.bortel (AT) gmail (DOT) com> schreef in bericht
news:7767f$478cff47$524b5c40$12171 (AT) cache5 (DOT) tilbu1.nb.home.nl...
nick wrote:
I understand that when you feed the count( ) function an asterisk as
an argument it runs
slower than if you use a column name as an argument. Can someone tell
me why this is so?

Thanks
Test it - it is not so - who do you believe?!?

--

Regards,
Frank van Bortel

Top-posting in UseNet newsgroups is one way to shut me up
O yes it is! If you have a sparse column (say col_a), indexed in a very
large table, count(col_a) will use the index , where count(*) doesn't
(and
they will return different values as well).
I think you confused this with select (*) and select (1) (which perform
the
same, although you might find a DBA at your current working place who is
convinced that count (8) is faster.....). They ARE not the same though,
for
count(*) from table in a view will not invalidate a view when a column is
added to the table, where count(1) will.....

Shakespeare


No I was not confused, though have to admit I misread the
column name bit.
The title had the start of another count(1) (or count(42),
for that matter) is better (or worse) that count(*).

That myth I wanted to stop right here.

As far as the count(col) vs count(*) myth:
http://www.oracledba.co.uk/tips/count_speed.htm

Of course, assuming you want to know how many
entries your table has (so not hanky-panky with
nullable columns!)
--

Regards,
Frank van Bortel

Top-posting in UseNet newsgroups is one way to shut me up

Sorry, that's what I meant too, but I wrote "select" where I should have
written "count".
And about hanky panky: it's nullable columns that make the difference in
count(column) and count(*) (different speed, different results).
The "myth" article is about count(1), count(*) and count (rowid) and things
like that.

Shakespeare

Shakespeare


As well as Primary Key columns - bottom line:
it does not matter.
http://asktom.oracle.com/pls/asktom/...15 6159920245
--

Regards,
Frank van Bortel

Top-posting in UseNet newsgroups is one way to shut me up


Reply With Quote
  #42  
Old   
shakespeare
 
Posts: n/a

Default Re: count(*) ? - 01-17-2008 , 06:43 AM







"Frank van Bortel" <frank.van.bortel (AT) gmail (DOT) com> schreef in bericht
news:cdbf0$478f34e8$524b5c40$1540 (AT) cache4 (DOT) tilbu1.nb.home.nl...
Quote:
shakespeare wrote:


mmm I must correct that, both views become invalid. Have seen examples
of
the contrary, will look them up and report....


Shakespeare


Got it.... in the pythian blogs:

http://www.pythian.com/blogs/627/ora...unt-and-count1

and seems to be an 11g issue, does not reproduce in my 10g database.

Shakespeare


And that case has nothing to do with the counting, but
with fine grained object dependency tracking.

--

Regards,
Frank van Bortel

Top-posting in UseNet newsgroups is one way to shut me up
That's what the comments on the article say, yes.

Shakespeare




Reply With Quote
  #43  
Old   
shakespeare
 
Posts: n/a

Default Re: count(*) ? - 01-17-2008 , 06:43 AM




"Frank van Bortel" <frank.van.bortel (AT) gmail (DOT) com> schreef in bericht
news:cdbf0$478f34e8$524b5c40$1540 (AT) cache4 (DOT) tilbu1.nb.home.nl...
Quote:
shakespeare wrote:


mmm I must correct that, both views become invalid. Have seen examples
of
the contrary, will look them up and report....


Shakespeare


Got it.... in the pythian blogs:

http://www.pythian.com/blogs/627/ora...unt-and-count1

and seems to be an 11g issue, does not reproduce in my 10g database.

Shakespeare


And that case has nothing to do with the counting, but
with fine grained object dependency tracking.

--

Regards,
Frank van Bortel

Top-posting in UseNet newsgroups is one way to shut me up
That's what the comments on the article say, yes.

Shakespeare




Reply With Quote
  #44  
Old   
shakespeare
 
Posts: n/a

Default Re: count(*) ? - 01-17-2008 , 06:43 AM




"Frank van Bortel" <frank.van.bortel (AT) gmail (DOT) com> schreef in bericht
news:cdbf0$478f34e8$524b5c40$1540 (AT) cache4 (DOT) tilbu1.nb.home.nl...
Quote:
shakespeare wrote:


mmm I must correct that, both views become invalid. Have seen examples
of
the contrary, will look them up and report....


Shakespeare


Got it.... in the pythian blogs:

http://www.pythian.com/blogs/627/ora...unt-and-count1

and seems to be an 11g issue, does not reproduce in my 10g database.

Shakespeare


And that case has nothing to do with the counting, but
with fine grained object dependency tracking.

--

Regards,
Frank van Bortel

Top-posting in UseNet newsgroups is one way to shut me up
That's what the comments on the article say, yes.

Shakespeare




Reply With Quote
  #45  
Old   
shakespeare
 
Posts: n/a

Default Re: count(*) ? - 01-17-2008 , 06:43 AM




"Frank van Bortel" <frank.van.bortel (AT) gmail (DOT) com> schreef in bericht
news:cdbf0$478f34e8$524b5c40$1540 (AT) cache4 (DOT) tilbu1.nb.home.nl...
Quote:
shakespeare wrote:


mmm I must correct that, both views become invalid. Have seen examples
of
the contrary, will look them up and report....


Shakespeare


Got it.... in the pythian blogs:

http://www.pythian.com/blogs/627/ora...unt-and-count1

and seems to be an 11g issue, does not reproduce in my 10g database.

Shakespeare


And that case has nothing to do with the counting, but
with fine grained object dependency tracking.

--

Regards,
Frank van Bortel

Top-posting in UseNet newsgroups is one way to shut me up
That's what the comments on the article say, yes.

Shakespeare




Reply With Quote
  #46  
Old   
shakespeare
 
Posts: n/a

Default Re: count(*) ? - 01-17-2008 , 06:45 AM



I agree....


Shakespeare


"Frank van Bortel" <frank.van.bortel (AT) gmail (DOT) com> schreef in bericht
news:ee2e3$478f3600$524b5c40$17910 (AT) cache2 (DOT) tilbu1.nb.home.nl...
Quote:
shakespeare wrote:
"Frank van Bortel" <frank.van.bortel (AT) gmail (DOT) com> schreef in bericht
news:ee096$478f27b0$524b5c40$17089 (AT) cache3 (DOT) tilbu1.nb.home.nl...
shakespeare wrote:
"Frank van Bortel" <frank.van.bortel (AT) gmail (DOT) com> schreef in bericht
news:7767f$478cff47$524b5c40$12171 (AT) cache5 (DOT) tilbu1.nb.home.nl...
nick wrote:
I understand that when you feed the count( ) function an asterisk as
an argument it runs
slower than if you use a column name as an argument. Can someone tell
me why this is so?

Thanks
Test it - it is not so - who do you believe?!?

--

Regards,
Frank van Bortel

Top-posting in UseNet newsgroups is one way to shut me up
O yes it is! If you have a sparse column (say col_a), indexed in a very
large table, count(col_a) will use the index , where count(*) doesn't
(and
they will return different values as well).
I think you confused this with select (*) and select (1) (which perform
the
same, although you might find a DBA at your current working place who
is
convinced that count (8) is faster.....). They ARE not the same though,
for
count(*) from table in a view will not invalidate a view when a column
is
added to the table, where count(1) will.....

Shakespeare


No I was not confused, though have to admit I misread the
column name bit.
The title had the start of another count(1) (or count(42),
for that matter) is better (or worse) that count(*).

That myth I wanted to stop right here.

As far as the count(col) vs count(*) myth:
http://www.oracledba.co.uk/tips/count_speed.htm

Of course, assuming you want to know how many
entries your table has (so not hanky-panky with
nullable columns!)
--

Regards,
Frank van Bortel

Top-posting in UseNet newsgroups is one way to shut me up

Sorry, that's what I meant too, but I wrote "select" where I should have
written "count".
And about hanky panky: it's nullable columns that make the difference in
count(column) and count(*) (different speed, different results).
The "myth" article is about count(1), count(*) and count (rowid) and
things
like that.

Shakespeare

Shakespeare


As well as Primary Key columns - bottom line:
it does not matter.
http://asktom.oracle.com/pls/asktom/...15 6159920245
--

Regards,
Frank van Bortel

Top-posting in UseNet newsgroups is one way to shut me up



Reply With Quote
  #47  
Old   
shakespeare
 
Posts: n/a

Default Re: count(*) ? - 01-17-2008 , 06:45 AM



I agree....


Shakespeare


"Frank van Bortel" <frank.van.bortel (AT) gmail (DOT) com> schreef in bericht
news:ee2e3$478f3600$524b5c40$17910 (AT) cache2 (DOT) tilbu1.nb.home.nl...
Quote:
shakespeare wrote:
"Frank van Bortel" <frank.van.bortel (AT) gmail (DOT) com> schreef in bericht
news:ee096$478f27b0$524b5c40$17089 (AT) cache3 (DOT) tilbu1.nb.home.nl...
shakespeare wrote:
"Frank van Bortel" <frank.van.bortel (AT) gmail (DOT) com> schreef in bericht
news:7767f$478cff47$524b5c40$12171 (AT) cache5 (DOT) tilbu1.nb.home.nl...
nick wrote:
I understand that when you feed the count( ) function an asterisk as
an argument it runs
slower than if you use a column name as an argument. Can someone tell
me why this is so?

Thanks
Test it - it is not so - who do you believe?!?

--

Regards,
Frank van Bortel

Top-posting in UseNet newsgroups is one way to shut me up
O yes it is! If you have a sparse column (say col_a), indexed in a very
large table, count(col_a) will use the index , where count(*) doesn't
(and
they will return different values as well).
I think you confused this with select (*) and select (1) (which perform
the
same, although you might find a DBA at your current working place who
is
convinced that count (8) is faster.....). They ARE not the same though,
for
count(*) from table in a view will not invalidate a view when a column
is
added to the table, where count(1) will.....

Shakespeare


No I was not confused, though have to admit I misread the
column name bit.
The title had the start of another count(1) (or count(42),
for that matter) is better (or worse) that count(*).

That myth I wanted to stop right here.

As far as the count(col) vs count(*) myth:
http://www.oracledba.co.uk/tips/count_speed.htm

Of course, assuming you want to know how many
entries your table has (so not hanky-panky with
nullable columns!)
--

Regards,
Frank van Bortel

Top-posting in UseNet newsgroups is one way to shut me up

Sorry, that's what I meant too, but I wrote "select" where I should have
written "count".
And about hanky panky: it's nullable columns that make the difference in
count(column) and count(*) (different speed, different results).
The "myth" article is about count(1), count(*) and count (rowid) and
things
like that.

Shakespeare

Shakespeare


As well as Primary Key columns - bottom line:
it does not matter.
http://asktom.oracle.com/pls/asktom/...15 6159920245
--

Regards,
Frank van Bortel

Top-posting in UseNet newsgroups is one way to shut me up



Reply With Quote
  #48  
Old   
shakespeare
 
Posts: n/a

Default Re: count(*) ? - 01-17-2008 , 06:45 AM



I agree....


Shakespeare


"Frank van Bortel" <frank.van.bortel (AT) gmail (DOT) com> schreef in bericht
news:ee2e3$478f3600$524b5c40$17910 (AT) cache2 (DOT) tilbu1.nb.home.nl...
Quote:
shakespeare wrote:
"Frank van Bortel" <frank.van.bortel (AT) gmail (DOT) com> schreef in bericht
news:ee096$478f27b0$524b5c40$17089 (AT) cache3 (DOT) tilbu1.nb.home.nl...
shakespeare wrote:
"Frank van Bortel" <frank.van.bortel (AT) gmail (DOT) com> schreef in bericht
news:7767f$478cff47$524b5c40$12171 (AT) cache5 (DOT) tilbu1.nb.home.nl...
nick wrote:
I understand that when you feed the count( ) function an asterisk as
an argument it runs
slower than if you use a column name as an argument. Can someone tell
me why this is so?

Thanks
Test it - it is not so - who do you believe?!?

--

Regards,
Frank van Bortel

Top-posting in UseNet newsgroups is one way to shut me up
O yes it is! If you have a sparse column (say col_a), indexed in a very
large table, count(col_a) will use the index , where count(*) doesn't
(and
they will return different values as well).
I think you confused this with select (*) and select (1) (which perform
the
same, although you might find a DBA at your current working place who
is
convinced that count (8) is faster.....). They ARE not the same though,
for
count(*) from table in a view will not invalidate a view when a column
is
added to the table, where count(1) will.....

Shakespeare


No I was not confused, though have to admit I misread the
column name bit.
The title had the start of another count(1) (or count(42),
for that matter) is better (or worse) that count(*).

That myth I wanted to stop right here.

As far as the count(col) vs count(*) myth:
http://www.oracledba.co.uk/tips/count_speed.htm

Of course, assuming you want to know how many
entries your table has (so not hanky-panky with
nullable columns!)
--

Regards,
Frank van Bortel

Top-posting in UseNet newsgroups is one way to shut me up

Sorry, that's what I meant too, but I wrote "select" where I should have
written "count".
And about hanky panky: it's nullable columns that make the difference in
count(column) and count(*) (different speed, different results).
The "myth" article is about count(1), count(*) and count (rowid) and
things
like that.

Shakespeare

Shakespeare


As well as Primary Key columns - bottom line:
it does not matter.
http://asktom.oracle.com/pls/asktom/...15 6159920245
--

Regards,
Frank van Bortel

Top-posting in UseNet newsgroups is one way to shut me up



Reply With Quote
  #49  
Old   
shakespeare
 
Posts: n/a

Default Re: count(*) ? - 01-17-2008 , 06:45 AM



I agree....


Shakespeare


"Frank van Bortel" <frank.van.bortel (AT) gmail (DOT) com> schreef in bericht
news:ee2e3$478f3600$524b5c40$17910 (AT) cache2 (DOT) tilbu1.nb.home.nl...
Quote:
shakespeare wrote:
"Frank van Bortel" <frank.van.bortel (AT) gmail (DOT) com> schreef in bericht
news:ee096$478f27b0$524b5c40$17089 (AT) cache3 (DOT) tilbu1.nb.home.nl...
shakespeare wrote:
"Frank van Bortel" <frank.van.bortel (AT) gmail (DOT) com> schreef in bericht
news:7767f$478cff47$524b5c40$12171 (AT) cache5 (DOT) tilbu1.nb.home.nl...
nick wrote:
I understand that when you feed the count( ) function an asterisk as
an argument it runs
slower than if you use a column name as an argument. Can someone tell
me why this is so?

Thanks
Test it - it is not so - who do you believe?!?

--

Regards,
Frank van Bortel

Top-posting in UseNet newsgroups is one way to shut me up
O yes it is! If you have a sparse column (say col_a), indexed in a very
large table, count(col_a) will use the index , where count(*) doesn't
(and
they will return different values as well).
I think you confused this with select (*) and select (1) (which perform
the
same, although you might find a DBA at your current working place who
is
convinced that count (8) is faster.....). They ARE not the same though,
for
count(*) from table in a view will not invalidate a view when a column
is
added to the table, where count(1) will.....

Shakespeare


No I was not confused, though have to admit I misread the
column name bit.
The title had the start of another count(1) (or count(42),
for that matter) is better (or worse) that count(*).

That myth I wanted to stop right here.

As far as the count(col) vs count(*) myth:
http://www.oracledba.co.uk/tips/count_speed.htm

Of course, assuming you want to know how many
entries your table has (so not hanky-panky with
nullable columns!)
--

Regards,
Frank van Bortel

Top-posting in UseNet newsgroups is one way to shut me up

Sorry, that's what I meant too, but I wrote "select" where I should have
written "count".
And about hanky panky: it's nullable columns that make the difference in
count(column) and count(*) (different speed, different results).
The "myth" article is about count(1), count(*) and count (rowid) and
things
like that.

Shakespeare

Shakespeare


As well as Primary Key columns - bottom line:
it does not matter.
http://asktom.oracle.com/pls/asktom/...15 6159920245
--

Regards,
Frank van Bortel

Top-posting in UseNet newsgroups is one way to shut me up



Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.