1

I am trying to understand the query plan of MonetDB.

Is there a documentation anywhere where I can find what each instruction stays for? If not, can anybody tell me what are returning

sql.projectdelta(X_15,X_23,X_25,r1_30,X_27) 

and

 sql.subdelta(X_246,X_4,X_10,X_247,X_249), for example?

In my query I am sorting the result by two attributes (e.g., by A,B). Can you tell me why the second sort has more parameters than the first?

(X_29,r1_36,r2_36) := algebra.subsort(X_28,false,false); 
(X_33,r1_40,r2_40) := algebra.subsort(X_22,r1_36,r2_36,false,false);             

Is algebra.subsort returning (oid, columnType) pairs, or just oid?

Thank you!!

Michael
  • 41,989
  • 11
  • 82
  • 128
user296733
  • 13
  • 2

1 Answers1

1

Understanding output of the explain SQL statement requires knowledge of the MonetDB Assembly-like Language (MAL).

Concerning functions sql.projectdelta, sql.subdelta, and algebra.subsort, you'll find their signature and a (brief) description in the monetdb lib folder. Ex :

  • [MonetDB_install_folder]\MonetDB5\lib\monetdb5\sql.mal for all sql functions
  • [MonetDB_install_folder]\MonetDB5\lib\monetdb5\algebra.mal for all algebra functions

Concerning the different number of parameters for algebra.subsort :

  • (X_29,r1_36,r2_36) := algebra.subsort(X_28,false,false); is described as :

    Returns a copy of the BAT sorted on tail values, a BAT that specifies how the input was reordered, and a BAT with group information. The input and output are (must be) dense headed. The order is descending if the reverse bit is set. This is a stable sort if the stable bit is set.

  • (X_33,r1_40,r2_40) := algebra.subsort(X_22,r1_36,r2_36,false,false); is described as:

    Returns a copy of the BAT sorted on tail values, a BAT that specifies how the input was reordered, and a BAT with group information. The input and output are (must be) dense headed. The order is descending if the reverse bit is set. This is a stable sort if the stable bit is set.

MAL functions can be overloaded bassed on their return value. algebra.subsort can return 1, 2 or 3 values depending on what you're asking for. Checl algebra.mal for the different possibilities.

Nicolas Riousset
  • 3,447
  • 1
  • 22
  • 25
  • 1
    Thank you. Checking those files helps. Some documentation (like the one of PostgreSQL for example) would be great though. – user296733 Apr 05 '16 at 11:47