Patent attributes
A database engine receives a database query that specifies retrieving data from a data source. The database engine parses the query to build an operator tree that includes a TableScan operator configured to scan a table from the data source to produce outputs corresponding to a single data field from the table, and includes a GroupBy operator that groups rows of the table according to the data field. The database engine generates and executes code corresponding to the operator tree to retrieve a result set. When the TableScan operator is a child of the GroupBy operator and the outputs are independent of duplicate input rows from the table, execution of the TableScan operator comprises, for each storage block of rows from the table: determining a storage compression scheme for encoding the data field and, for certain encodings, using the encoding to produce the outputs without duplication of rows.