And I should have read the post more clearly. I thought it was count(l), not 
count(1). But, either way, you’re counting the number of records in the table, 
which in the RDBMS world means scanning an index, and in Cassandra means the 
coordinator has to select all the records from all the nodes.

In general, counting records in Cassandra is bad. People are accustomed to 
counting being a cheap operation, but in any distributed database with 
replication, it is going to be expensive. If your data model requires that you 
count large number of records, then I recommend you revise your data model and 
maintain a counter. I know that can be a pain, but there really is not way to 
count records fast.

On Apr 22, 2015, at 7:49 AM, Mich Talebzadeh 
<m...@peridale.co.uk<mailto:m...@peridale.co.uk>> wrote:

Thanks Robert,

In RDBMS select count(1) basically returns the rows.

1> select count(1) from t
2> go

-----------
      300000

(1 row affected)

Is count(1) fundamentally different in Cassandra?

Does count(1) means return (in my case) 1 three hundred thousand time?

Cheers,


Mich Talebzadeh

http://talebzadehmich.wordpress.com<http://talebzadehmich.wordpress.com/>

Author of the books "A Practitioner’s Guide to Upgrading to Sybase ASE 15", 
ISBN 978-0-9563693-0-7.
co-author "Sybase Transact SQL Guidelines Best Practices", ISBN 
978-0-9759693-0-4
Publications due shortly:
Creating in-memory Data Grid for Trading Systems with Oracle TimesTen and 
Coherence Cache
Oracle and Sybase, Concepts and Contrasts, ISBN: 978-0-9563693-1-4, volume one 
out shortly

NOTE: The information in this email is proprietary and confidential. This 
message is for the designated recipient only, if you are not the intended 
recipient, you should destroy it immediately. Any information in this message 
shall not be understood as given or endorsed by Peridale Ltd, its subsidiaries 
or their employees, unless expressly so stated. It is the responsibility of the 
recipient to ensure that this email is virus free, therefore neither Peridale 
Ltd, its subsidiaries nor their employees accept any responsibility.

From: Robert Wille [mailto:rwi...@fold3.com]
Sent: 22 April 2015 14:44
To: user@cassandra.apache.org<mailto:user@cassandra.apache.org>
Subject: Re: OperationTimedOut in selerct count statement in cqlsh

Keep in mind that "select count(l)" and "select l" amount to essentially the 
same thing.

On Apr 22, 2015, at 3:41 AM, Tommy Stendahl 
<tommy.stend...@ericsson.com<mailto:tommy.stend...@ericsson.com>> wrote:


Hi,

Checkout CASSANDRA-8899, my guess is that you have to increase the timeout in 
cqlsh.

/Tommy
On 2015-04-22 11:15, Mich Talebzadeh wrote:
Hi,

I have a table of 300,000 rows.

When I try to do a simple

cqlsh:ase> select count(1) from t;
OperationTimedOut: errors={}, last_host=127.0.0.1

Appreciate any feedback

Thanks,

Mich


NOTE: The information in this email is proprietary and confidential. This 
message is for the designated recipient only, if you are not the intended 
recipient, you should destroy it immediately. Any information in this message 
shall not be understood as given or endorsed by Peridale Ltd, its subsidiaries 
or their employees, unless expressly so stated. It is the responsibility of the 
recipient to ensure that this email is virus free, therefore neither Peridale 
Ltd, its subsidiaries nor their employees accept any responsibility.

Reply via email to