the invention is particularly well adapted for use with distributed database systems which compresses data at the storage level using rle - based compression and structured query language ( sql ) queries , and will be described in that environment . it will become apparent , however , that this is illustrative of only one utility of the invention and that the invention may be employed with other databases , with other types of compression , and with other query languages . fig1 illustrates a shared - nothing network architecture of a logical database 100 of the type with which the invention may be employed . the network may include a master node 102 which connects to and manages a plurality of shared - nothing nodes 104 - a through 104 - n . each node may comprise a plurality of database segments ( database instances ) including one or more primary databases and one or more mirror databases . data may be stored in the segments in compressed form using run length encoding ( rle ) compression , for example , and accessed using queries such as sql queries . clients 106 may interact with the database through the master node 102 . fig2 illustrates a master node 202 configured to implement operations in accordance with the invention . the master node may comprise a host computer system 210 ( which may be a multi - processor system comprising a plurality of cpus ) connected to input / output ( i / o ) devices 212 by a bus 214 . the i / o devices may be standard computer system input and output devices . a network interface circuit 216 may also be connected to bus 214 to allow the master node to operate in a networked environment . clients 106 may communicate with the distributed database through the master node ( see fig1 ) using either the i / o devices or the network interface circuit . the master node may also have a memory 220 connected to the bus that embodies executable instructions to control the operation of the host computer system of the node and to perform processes in accordance with the invention . included in memory 220 may be a main memory 222 and a query optimizer 224 comprising instructions that control the cpu to perform query optimization processes in accordance with the invention . as will be described , the invention affords optimization of queries on databases employing rle - based compression at the storage level . it provides a framework to exploit rle compression during query optimization to optimize the queries to minimize computation costs and reduce overall response time . optimization processes in accordance with embodiments of the invention identify logical query plans , or portions thereof , that bind to certain predetermined patterns and include certain predetermined query operators and / or aggregation operations involving rle - compressed relations to which logical transformations may be applied that rearrange the query plan and / or use different query operators to produce an optimized logically equivalent plan . the logical query plans are then transformed into the optimized logically equivalent plans . the transformed plans enable optimized queries to operate directly on compressed data and produce correct results without first having to decompress the data . this minimizes computation costs and reduces overall response time by avoiding the necessity of performing multiple query computations on uncompressed data that is the same . a logical query plan comprises a tree of query language operators that correspond to relational operations such as get , compress , decompress , join , groupby , and others . the output of each operator is a relation , and each operator produces a set of output columns . for instance , a get operator corresponds to reading a relation from a storage device and presenting the data in tabular form . this operator has no children . the join operator has two children which correspond to its inputs . it possesses a qualification expression that corresponds to the join condition between two relations . a groupby operator has one child as an input and has a set of grouping columns that should be logically grouped to compute the output relation . the output of the groupby operator may be associated with aggregate functions such as sum , min and count . a compress operator has one child , and transforms an uncompressed relation to a compressed one . a decompress operator performs the reverse function by transforming a compressed relation into an uncompressed one . for example , a stream of numbers & lt ; 5 , 5 , 6 , 6 , 6 , 6 , 1 , 1 & gt ; may be rle compressed to the form & lt ;( 5 , 2 ),( 6 , 4 ),( 1 , 2 )& gt ; where second number represents frequency of occurrence of the first element ( number ). the compress operation goes from a stream of objects to rle - compressed form , whereas the decompress operation goes in the opposite direction . fig3 is an example of a logical query plan for a query of the form : select r . r from r inner join t on ( r . r = t . t ). r is a relation , e . g ., a table , with one column “ r . r ”, where “ r ” is a column value . similarly , t is a relation with a column “ t . t ”, where “ t ” is a column value . the get ( r ) operator 302 and the get ( t ) operator 304 read values ( r . r ) 306 and ( t . t ) 308 , respectively . the join operator 310 has a condition “ r . r ,= t . t ” 312 , that determines whether the values “ r ” and “ t ” are equal , and provides the answer to a client 320 . fig4 illustrates a query plan for the same query applied to a compressed database . the rle - compressed form of relation r may be designated r c and has two columns ( r c . r , r c . f ), where the second column corresponds to the frequency of occurrence “ f ” of a particular “ r ” value . similarly , the rle - compressed form of relation t may be designated t c with columns ( t c . t , t c . f ) where the second column indicates the frequency of occurrence of the value “ t ”. in fig4 , the operator get ( r c ) 402 obtains the values ( r . r , r . f ) 404 and a decompress operator 406 decompress the values to obtain the values “ r ” 408 . similarly , the operator get ( t c ) 410 obtains the values ( t . t , t . f ) 412 , and a decompress operator 414 decompress the values to obtain the values “ t ” 416 . a join operator 418 having the condition “ r . r ,= t . t ” 420 determines whether the value of “ r ” and the value of “ t ” provided by operators 406 and 414 , respectively , are equal , and provides the answer to a client 430 . the logical query plan of fig4 compares each decompressed value “ r ” of r with a given decompressed value “ t ” of t in the join operation 418 , and then repeats this process for the next decompressed value “ t ”. where the value “ r ” has a frequency of occurrence of “ f r ” and the value “ t ” has a frequency of occurrence of “ f t ”, the query is run f r times using the same value “ r ” for each of the f t occurrences of the same value “ t ”. thus , the number of times that the query must be run on the same data is f r multiplied by f t . if , for example , f r = 4 and f t = 3 , the query must be executed on the same data values 4 * 3 = 12 times , which is costly , time - consuming and inefficient . as will be described , the invention identifies certain patterns in query plans that can be transformed to an optimized plan so that it operates directly on compressed data and provides the correct answer , thus avoiding multiple repeats of a query on data that is the same . a transformation takes an input query plan and produces a logically equivalent query plan . every transformation has a precondition that must be satisfied for the transformation to be applicable . the precondition is typically expressed as a pattern tree . if there &# 39 ; s a binding ( matching ) of the input plan to the pattern tree , then the transformation is applicable . fig5 a and 5b illustrate , respectively , a pattern tree and a simple transformation for join commutativity . the transformation shown in fig5 b of an input query plan binding to the pattern tree of fig5 a merely exchanges the left and right children 502 and 504 of the join operator 506 as shown at 508 and 510 for the join operator 512 . as shown in the figures , both the input plan and the transformation produce the same result 514 , which is a requirement for an acceptable transformation . the invention affords patterns and transformations that enable input query plans , or portions thereof , that bind to certain patterns and which operate on uncompressed data to be transformed so that their transformations operate directly on compressed data to produce the correct answers . while pattern binding and transformations are generally known , they have not previously been applied to compressed data . known query optimization techniques that are applicable to queries for uncompressed data are very difficult to apply to optimize queries that can be used for compressed data and produce correct answers . the invention identifies those query plans that can be transformed to operate correctly on compressed data by matching the structures and semantics of queries to certain predetermined patterns . the invention then transforms the query plans ( and queries ) accordingly . transformations in accordance with the invention take as an input a query plan such as illustrated in fig4 which decompresses relations early in the query so that the query operates on uncompressed data , and transforms the input query plan to one that decompresses higher up ( later ), or avoids decompression altogether , so that the transformed query plan operates on compressed data . this enables database operations to work on smaller chunks of compressed data , resulting in better performance . this process is illustrated in fig6 and 7 . fig6 illustrates a pattern for an input plan that is similar to the logical query plan of fig4 . as shown , the pattern has decompress operators 602 and 604 early in the query that decompress compressed data prior to a join operator 610 . this means that the join operates on decompressed data and that the query must be run multiple times on data values that are the same , as previously explained . fig7 illustrates a transformation of the query plan pattern of fig6 in accordance with an embodiment of the invention , where the decompress operator 700 has been moved above the join operator 710 so that decompress operates on the results of the join operation . in addition , as indicated at 720 , the second output column of the join operator multiplies the frequencies ($ 3 *$ 5 ) from its left and right children 722 , 724 , respectively . notably , the transformed plan of fig7 produces the same answer 730 as the answer 612 produced by the input query plan of fig6 , demonstrating that the transformation produces a logically equivalent query that minimizes processing and overall response time to obtain correct answers . fig8 illustrates another transformation of the logical query plan of fig4 that is substantially similar to the transformation illustrated in fig7 , except that the transformation of fig8 eliminates the decompress operation altogether from the plan . as shown in fig8 , the output of the join operation 810 is supplied directly to the client 812 , and the decompress operation 820 is moved from the query to the client . this advantageously further reduces the processing that the master node of the database must perform , which improves the database response time to queries . in a large distributed database , moving decompression to a client can result in a substantial improvement in query response time . fig9 a and 9b illustrate , respectively , another input query plan pattern for use with compressed data , and a corresponding transformation of the input plan in accordance with an embodiment of the invention where the transformed plan uses a different query operation to work directly on compressed relations . the pattern of fig9 a applies to an input query on compressed data r c of the form : select count (*) from r c group by r c . r . the pattern has a decompress operator 900 that decompresses compressed data 910 before it is operated on by a groupby operator 920 which groups the results of a count operation to provide an answer 940 to the query . the transformation of fig9 b changes both the form of the input query as well as its query operators . the query is transformed to : select sum ( r c . f ) from r c group by r c . r . as shown , the count operator 930 is replaced with a sum operator 942 . in the transformed plan , the groupby operator 946 produces an answer 948 that is the same as the answer 940 produced by a query operating on decompressed data . this enables eliminating altogether the decompress operator 900 from the transformed plan so that it operates on compressed data . this transformation is made possible by the invention because of the discovery that a count operation on uncompressed data in the pattern of fig9 a is equivalent to a sum operation on compressed data in the transformed plan of fig9 b . the foregoing pattern binding and transformation process of the invention may be applied repeatedly to different portions of a more complex query plan to optimize those portions for compressed data and to produce a new overall query plan that is less costly computationally and that has an improved response time . while the foregoing description has been with reference to particular embodiments of the invention , it will be appreciated by those skilled in the art that modifications to these embodiments may be made without departing from the principles and spirit the invention , the scope of which is defined by the appended claims .