Discussion:
[nhusers] nhiberanate count(*) change to count(1)
郭骞
2018-08-27 07:29:02 UTC
Permalink
Hi All,
is it possiblle for nhibernate query count sql generated not select
count(*) but count(1) ?
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhusers+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
Ricardo Peres
2018-08-27 20:55:24 UTC
Permalink
I agree. Why don't you create an issue
on https://github.com/nhibernate/nhibernate-core? Maybe someone can pick it
up.

RP
Post by 郭骞
Hi All,
is it possiblle for nhibernate query count sql generated not select
count(*) but count(1) ?
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhusers+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
Gunnar Liljas
2018-08-27 21:07:45 UTC
Permalink
It's certainly possible, but I don't understand why it would be an
advantage.

/G
I agree. Why don't you create an issue on
https://github.com/nhibernate/nhibernate-core? Maybe someone can pick it
up.
RP
Post by 郭骞
Hi All,
is it possiblle for nhibernate query count sql generated not select
count(*) but count(1) ?
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhusers+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
Ricardo Peres
2018-08-28 08:42:40 UTC
Permalink
Yes, COUNT(1) and COUNT(*) are exactly the same.

RP
Post by Gunnar Liljas
It's certainly possible, but I don't understand why it would be an
advantage.
/G
I agree. Why don't you create an issue on
https://github.com/nhibernate/nhibernate-core? Maybe someone can pick it
up.
RP
Post by 郭骞
Hi All,
is it possiblle for nhibernate query count sql generated not select
count(*) but count(1) ?
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an
<javascript:>.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhusers+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
Danny Van den Wouwer
2018-08-28 08:58:43 UTC
Permalink
Good database software knows that if you use the aggregate function
count(*) you don't want to retrieve internally all fields of all the
involved tables. So count(*) might even be slightly faster then count(1)
in those cases. It is not a good idea to change this behaviour to count(1).
Can you tell me which database server you using?

Vriendelijke groeten,
Van den Wouwer Danny

Software Engineer
Peopleware NV
www.peopleware.be
Post by Ricardo Peres
Yes, COUNT(1) and COUNT(*) are exactly the same.
RP
Post by Gunnar Liljas
It's certainly possible, but I don't understand why it would be an
advantage.
/G
I agree. Why don't you create an issue on
https://github.com/nhibernate/nhibernate-core? Maybe someone can pick
it up.
RP
Post by 郭骞
Hi All,
is it possiblle for nhibernate query count sql generated not
select count(*) but count(1) ?
--
You received this message because you are subscribed to the Google
Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhusers+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
郭骞
2018-08-30 07:41:54 UTC
Permalink
Hi Danny,
I use sql server 2012,for count(1) query will improve a lot because it
just return row_number

圚 2018幎8月28日星期二 UTC+8䞋午5:04:09Danny Van den Wouwer写道
Post by Danny Van den Wouwer
Good database software knows that if you use the aggregate function
count(*) you don't want to retrieve internally all fields of all the
involved tables. So count(*) might even be slightly faster then count(1)
in those cases. It is not a good idea to change this behaviour to count(1).
Can you tell me which database server you using?
Vriendelijke groeten,
Van den Wouwer Danny
Software Engineer
Peopleware NV
www.peopleware.be
Post by Ricardo Peres
Yes, COUNT(1) and COUNT(*) are exactly the same.
RP
Post by Gunnar Liljas
It's certainly possible, but I don't understand why it would be an
advantage.
/G
I agree. Why don't you create an issue on
https://github.com/nhibernate/nhibernate-core? Maybe someone can pick
it up.
RP
Post by 郭骞
Hi All,
is it possiblle for nhibernate query count sql generated not
select count(*) but count(1) ?
--
You received this message because you are subscribed to the Google
Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an
<javascript:>.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhusers+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
Danny Van den Wouwer
2018-08-30 13:14:06 UTC
Permalink
Hi,

Can you:

1. show me your query (hql, icriteria, queryover or Linq) and the
generated query by nhibernate
2. show me the sql that you actually want


Met vriendelijke groeten,

Danny Van den Wouwer
*Software Engineer*

*PEOPLEWARE*
Duwijckstraat 17
2500 Lier - Belgium
+32 3 448.33.38 Facebook
<http://www.facebook.com/pages/Peopleware/115011795207742> Twitter
<http://twitter.com/#!/PeopleWareBE>
www.peopleware.be
Post by 郭骞
Hi Danny,
I use sql server 2012,for count(1) query will improve a lot because
it just return row_number
圚 2018幎8月28日星期二 UTC+8䞋午5:04:09Danny Van den Wouwer写道
Post by Danny Van den Wouwer
Good database software knows that if you use the aggregate function
count(*) you don't want to retrieve internally all fields of all the
involved tables. So count(*) might even be slightly faster then count(1)
in those cases. It is not a good idea to change this behaviour to count(1).
Can you tell me which database server you using?
Vriendelijke groeten,
Van den Wouwer Danny
Software Engineer
Peopleware NV
www.peopleware.be
Post by Ricardo Peres
Yes, COUNT(1) and COUNT(*) are exactly the same.
RP
Post by Gunnar Liljas
It's certainly possible, but I don't understand why it would be an
advantage.
/G
I agree. Why don't you create an issue on
https://github.com/nhibernate/nhibernate-core? Maybe someone can pick
it up.
RP
Post by 郭骞
Hi All,
is it possiblle for nhibernate query count sql generated not
select count(*) but count(1) ?
--
You received this message because you are subscribed to the Google
Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google
Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhusers+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
郭骞
2018-08-30 07:46:01 UTC
Permalink
Acturely It's not same,

圚 2018幎8月28日星期二 UTC+8䞋午4:42:40Ricardo Peres写道
Post by Ricardo Peres
Yes, COUNT(1) and COUNT(*) are exactly the same.
RP
Post by Gunnar Liljas
It's certainly possible, but I don't understand why it would be an
advantage.
/G
I agree. Why don't you create an issue on
https://github.com/nhibernate/nhibernate-core? Maybe someone can pick
it up.
RP
Post by 郭骞
Hi All,
is it possiblle for nhibernate query count sql generated not
select count(*) but count(1) ?
--
You received this message because you are subscribed to the Google
Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nhusers+***@googlegroups.com.
To post to this group, send email to ***@googlegroups.com.
Visit this group at https://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.
Loading...