Selective to get into cassandra faster than usual?

I would like to know if this:

$column_family->get('row_key', $columns=array('name1', 'name2')); 

Faster than more flexible access now I use:

 $column_family->get('row_key'); 

Method 1 is harder to implement, but will it give less load / bandwidth / delay?

+6
source share
2 answers

The first is faster, especially if you work with large tables that contain many columns.

Even you only have two columns with the name name1 and name2 , specifying their names, you should avoid extracting the column names from the table structure on the MySQL side. Therefore, it should be faster than using the selector * .

However, test your results using microtime () in PHP against large tables and you will see what I am saying. Of course, if you have 20+ columns in the table and you want to extract them, then it’s easier to place * than to list all these column names, but in terms of speed, the enumeration of the columns is a bit faster.

The best way to test this conclusion is to test it yourself.

+2
source

Cassandra is not mysql, so it’s not surprising that some things are different there. :)

In this case, the Cassandra sparse row storage model means that for a small number of columns, the full-sized version will be faster because Cassandra does not need to deserialize and validate its column records at the row level.

Of course, for more columns, the extra deserialization work more than you need will dominate again.

Bottom line: worrying about this is almost certainly premature optimization. If not, check.

+3
source

Source: https://habr.com/ru/post/887466/


All Articles