Opened 10 years ago

Closed 10 years ago

#617 closed enhancement (invalid)

rasql insert within an MDD object

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 (8)

comment:1 by Dimitar Misev, 10 years ago

Description: modified (diff)

comment:2 by Dimitar Misev, 10 years ago

Description: modified (diff)

comment:3 by Dimitar Misev, 10 years ago

Description: modified (diff)

comment:4 by Peter Baumann, 10 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 10 years ago by Peter Baumann (previous) (diff)

comment:5 by Dimitar Misev, 10 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, 10 years ago

Description: modified (diff)

comment:7 by Peter Baumann, 10 years ago

…but care has to be taken that the tiling scheme is not violated. An interesting optimization problem: do the data shift with minimal tile updates in presence of some given tiling scheme.

comment:8 by Dimitar Misev, 10 years ago

Resolution: invalid
Status: newclosed

I think such an optimization will not be possible in the general case, as the target domain can already have some data which needs to be overwritten, so moving just the index entry will not work. Closing ticket therefore.

Note: See TracTickets for help on using tickets.