The fetch-all would disable query optimization upon the sstable. In org.apache.cassandra.db.SinglePartitionReadCommand#queryMemtableAndDiskInternal:
if (clusteringIndexFilter() instanceof ClusteringIndexNamesFilter && !queriesMulticellType()) return queryMemtableAndSSTablesInTimestampOrder(cfs, (ClusteringIndexNamesFilter)clusteringIndexFilter()); Here the uses the fetched but not queried columns: private boolean queriesMulticellType() { for (ColumnDefinition column : columnFilter().fetchedColumns()) { if (column.type.isMultiCell() || column.type.isCounter()) return true; } return false; } So, if the table has one column in complex type, then it would need to iterate all sstables containing the rows, but in fact it would not have to. Could anyone explain why? Jinhua Luo <luajit...@gmail.com> 于2019年1月25日周五 下午7:41写道: > > Hi, > > I found the columnfilter.isFetchAll is always true even when I select > a subset of columns. > > In the codes: > > private ColumnFilter gatherQueriedColumns() > { > if (selection.isWildcard()) > return ColumnFilter.all(cfm); > > ColumnFilter.Builder builder = ColumnFilter.allColumnsBuilder(cfm); > // Adds all selected columns > for (ColumnDefinition def : selection.getColumns()) > if (!def.isPrimaryKeyColumn()) > builder.add(def); > // as well as any restricted column (so we can actually apply the > restriction) > builder.addAll(restrictions.nonPKRestrictedColumns(true)); > return builder.build(); > } > > Here ColumnFilter.allColumnsBuilder(cfm) set isFetchAll to true. > > Why? --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@cassandra.apache.org For additional commands, e-mail: user-h...@cassandra.apache.org