1

I have inherited a PostgreSQL db and I am trying to run queries like this:

UPDATE geomtable a 
    SET column = ST_Value(b.rast, 1, a.geom)
    FROM rastertable b
    WHERE  ST_Intersects(b.rast,a.geom);

It is very slow which makes me think the rasters, which are big (6000x4000), are not tiled. How can I check if they are tiled and if so what size the tiles are?

1 Answer 1

3

According to the docs:

The blocksize_x and blocksize_y columns in the raster_columns view represent the width and height (in pixels) of the raster blocks (often called tiles) in the raster column.

SELECT 
    r_table_name, 
    r_raster_column, 
    blocksize_x, 
    blocksize_y
FROM 
    raster_columns 
WHERE 
    r_table_name = 'mytable' 
    AND r_raster_column = 'rast';

So if the raster is stored as one large block (meaning it's not split into smaller tiles), then the blocksize_x and blocksize_y values would match the overall width and height of the raster. On the other hand, if the raster is stored as multiple tiles (split into smaller blocks), the blocksize_x and blocksize_y values would be smaller than the overall width and height of the raster.

3

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.