Opened 11 years ago

Last modified 11 years ago

#617 closed enhancement

rasql insert within an MDD object — at Version 6

Reported by: Dimitar Misev Owned by: Dimitar Misev
Priority: major Milestone: Future
Component: qlparser Version: development
Keywords: Cc: Piero Campalani, Peter Baumann
Complexity: Medium

Description (last modified by Dimitar Misev)

Inserting a slice in the middle of a 3D cube is possible via a partial update, e.g.

UPDATE 3Dcube AS c
SET c[ 5:*, *:*, *:* ] -- assuming shift position 5 in dimension 0
ASSIGN shift( c[ 5:*, *:*, *:* ], [1,0,0] )

The problem is that this is inefficient, as it requires updating a lot of data. This could be implemented efficiently without moving any data but just shifting some tile OIDs in the index.

Change History (6)

comment:1 by Dimitar Misev, 11 years ago

Description: modified (diff)

comment:2 by Dimitar Misev, 11 years ago

Description: modified (diff)

comment:3 by Dimitar Misev, 11 years ago

Description: modified (diff)

comment:4 by Peter Baumann, 11 years ago

INSERT is used for inserting aon (oid,array) tuple, so such functionality would fit into partial UPDATE instead.
Isn't this already doable through something like

UPDATE 3Dcube AS c
SET c[ 5:*, *:*, *:* ] -- assuming shift position 5 in dimension 0
ASSIGN shift( c, [1,0,0] )
UPDATE 3Dcube AS c
SET c[ 5, *:*, *:* ] -- slot freed gets new values
ASSIGN shift( inv_tiff( $1 ), [5,*,*] )

or, in one query:

UPDATE 3Dcube AS c
SET c[ 5:*, *:*, *:* ]
ASSIGN
    concat(
        shift( inv_tiff( $1 ), [5,0,0] ),
        shift(c,[1,0,0])
    )
Last edited 11 years ago by Peter Baumann (previous) (diff)

comment:5 by Dimitar Misev, 11 years ago

Hey this actually works! I didn't expect it :) Note in the shift you need a trim as well:

UPDATE 3Dcube AS c
SET c[ 5:*, *:*, *:* ] -- assuming shift position 5 in dimension 0
ASSIGN shift( c[ 5:*, *:*, *:* ], [1,0,0] )

We just need to make this efficient, so that it doesn't require actual movement of the data.

comment:6 by Dimitar Misev, 11 years ago

Description: modified (diff)
Note: See TracTickets for help on using tickets.