Skip to content

Commit b6fadd2

Browse files
committed
Exclude objects without a version.
Signed-off-by: Maximilian Chrzan <maximilian.chrzan@here.com>
1 parent ac3abae commit b6fadd2

File tree

2 files changed

+34
-34
lines changed

2 files changed

+34
-34
lines changed

xyz-psql-connector/src/main/java/com/here/xyz/psql/DatabaseMaintainer.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public class DatabaseMaintainer {
4747
private static final Logger logger = LogManager.getLogger();
4848

4949
/** Is used to check against xyz_ext_version() */
50-
public static final int XYZ_EXT_VERSION = 147;
50+
public static final int XYZ_EXT_VERSION = 148;
5151

5252
public static final int H3_CORE_VERSION = 107;
5353

xyz-psql-connector/src/main/resources/xyz_ext.sql

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ DROP FUNCTION IF EXISTS xyz_statistic_history(text, text);
153153
CREATE OR REPLACE FUNCTION xyz_ext_version()
154154
RETURNS integer AS
155155
$BODY$
156-
select 147
156+
select 148
157157
$BODY$
158158
LANGUAGE sql IMMUTABLE;
159159
------------------------------------------------
@@ -208,7 +208,7 @@ CREATE OR REPLACE FUNCTION xyz_statistic_history(
208208
RETURNS TABLE(tablesize jsonb, count jsonb, maxversion jsonb, minversion jsonb) AS
209209
$BODY$
210210
/**
211-
* Description: Returns completet statisic about a big xyz-space. Therefor the results are including estimated values to reduce
211+
* Description: Returns complete statistic about a big xyz-space. Therefore the results are including estimated values to reduce
212212
* the runtime of the query.
213213
*
214214
* Parameters:
@@ -234,37 +234,37 @@ $BODY$
234234
SELECT reltuples into estimate_cnt FROM pg_class WHERE oid = concat('"',$1, '"."', $2, '"')::regclass;
235235

236236
IF estimate_cnt > big_space_threshold THEN
237-
RETURN QUERY EXECUTE
238-
'SELECT format(''{"value": %s, "estimated" : true}'', tablesize)::jsonb as tablesize, '
239-
||' format(''{"value": %s, "estimated" : true}'', count)::jsonb as count, '
240-
||' format(''{"value": %s, "estimated" : false}'', COALESCE(maxversion,0))::jsonb as maxversion, '
241-
||' format(''{"value": %s, "estimated" : false}'', COALESCE(minversion,0))::jsonb as minversion '
242-
||' FROM ('
243-
||' SELECT pg_total_relation_size('''||schema||'."'||spaceid||'"'') AS tablesize, '
244-
||' (SELECT jsondata->''properties''->''@ns:com:here:xyz''->''version'' FROM "'||schema||'"."'||spaceid||'"'
245-
||' order by jsondata->''properties''->''@ns:com:here:xyz''->''version'' DESC limit 1 )::TEXT::INTEGER as maxversion,'
246-
||' (SELECT jsondata->''properties''->''@ns:com:here:xyz''->''version'' FROM "'||schema||'"."'||spaceid||'"'
247-
||' WHERE jsondata->''properties''->''@ns:com:here:xyz''->''version'' > to_jsonb(0::numeric) '
248-
||' order by jsondata->''properties''->''@ns:com:here:xyz''->''version'' ASC limit 1 )::TEXT::INTEGER as minversion,'
249-
||' reltuples AS count '
250-
||' FROM pg_class '
251-
||' WHERE oid='''||schema||'."'||spaceid||'"''::regclass) A';
237+
RETURN QUERY EXECUTE
238+
'SELECT format(''{"value": %s, "estimated" : true}'', tablesize)::jsonb as tablesize, '
239+
||' format(''{"value": %s, "estimated" : true}'', count)::jsonb as count, '
240+
||' format(''{"value": %s, "estimated" : false}'', COALESCE(maxversion,0))::jsonb as maxversion, '
241+
||' format(''{"value": %s, "estimated" : false}'', COALESCE(minversion,0))::jsonb as minversion '
242+
||' FROM ('
243+
||' SELECT pg_total_relation_size('''||schema||'."'||spaceid||'"'') AS tablesize, '
244+
||' (SELECT jsondata->''properties''->''@ns:com:here:xyz''->''version'' FROM "'||schema||'"."'||spaceid||'" where jsondata->''properties''->''@ns:com:here:xyz''->''version'' is not null'
245+
||' order by jsondata->''properties''->''@ns:com:here:xyz''->''version'' DESC limit 1 )::TEXT::INTEGER as maxversion,'
246+
||' (SELECT jsondata->''properties''->''@ns:com:here:xyz''->''version'' FROM "'||schema||'"."'||spaceid||'"'
247+
||' WHERE jsondata->''properties''->''@ns:com:here:xyz''->''version'' > to_jsonb(0::numeric) '
248+
||' order by jsondata->''properties''->''@ns:com:here:xyz''->''version'' ASC limit 1 )::TEXT::INTEGER as minversion,'
249+
||' reltuples AS count '
250+
||' FROM pg_class '
251+
||' WHERE oid='''||schema||'."'||spaceid||'"''::regclass) A';
252252
ELSE
253-
RETURN QUERY EXECUTE
254-
'SELECT format(''{"value": %s, "estimated" : true}'', tablesize)::jsonb as tablesize, '
255-
||' format(''{"value": %s, "estimated" : false}'', count)::jsonb as count, '
256-
||' format(''{"value": %s, "estimated" : false}'', COALESCE(maxversion,0))::jsonb as maxversion, '
257-
||' format(''{"value": %s, "estimated" : false}'', COALESCE(minversion,0))::jsonb as minversion '
258-
||' FROM ('
259-
||' SELECT pg_total_relation_size('''||schema||'."'||spaceid||'"'') AS tablesize, '
260-
||' (SELECT jsondata->''properties''->''@ns:com:here:xyz''->''version'' FROM "'||schema||'"."'||spaceid||'"'
261-
||' order by jsondata->''properties''->''@ns:com:here:xyz''->''version'' DESC limit 1 )::TEXT::INTEGER as maxversion,'
262-
||' (SELECT jsondata->''properties''->''@ns:com:here:xyz''->''version'' FROM "'||schema||'"."'||spaceid||'"'
263-
||' WHERE jsondata->''properties''->''@ns:com:here:xyz''->''version'' > to_jsonb(0::numeric) '
264-
||' order by jsondata->''properties''->''@ns:com:here:xyz''->''version'' ASC limit 1 )::TEXT::INTEGER as minversion,'
265-
||' (SELECT count(*) FROM "'||schema||'"."'||spaceid||'") AS count '
266-
||' FROM pg_class '
267-
||' WHERE oid='''||schema||'."'||spaceid||'"''::regclass) A';
253+
RETURN QUERY EXECUTE
254+
'SELECT format(''{"value": %s, "estimated" : true}'', tablesize)::jsonb as tablesize, '
255+
||' format(''{"value": %s, "estimated" : false}'', count)::jsonb as count, '
256+
||' format(''{"value": %s, "estimated" : false}'', COALESCE(maxversion,0))::jsonb as maxversion, '
257+
||' format(''{"value": %s, "estimated" : false}'', COALESCE(minversion,0))::jsonb as minversion '
258+
||' FROM ('
259+
||' SELECT pg_total_relation_size('''||schema||'."'||spaceid||'"'') AS tablesize, '
260+
||' (SELECT jsondata->''properties''->''@ns:com:here:xyz''->''version'' FROM "'||schema||'"."'||spaceid||'" where jsondata->''properties''->''@ns:com:here:xyz''->''version'' is not null'
261+
||' order by jsondata->''properties''->''@ns:com:here:xyz''->''version'' DESC limit 1 )::TEXT::INTEGER as maxversion,'
262+
||' (SELECT jsondata->''properties''->''@ns:com:here:xyz''->''version'' FROM "'||schema||'"."'||spaceid||'"'
263+
||' WHERE jsondata->''properties''->''@ns:com:here:xyz''->''version'' > to_jsonb(0::numeric) '
264+
||' order by jsondata->''properties''->''@ns:com:here:xyz''->''version'' ASC limit 1 )::TEXT::INTEGER as minversion,'
265+
||' (SELECT count(*) FROM "'||schema||'"."'||spaceid||'") AS count '
266+
||' FROM pg_class '
267+
||' WHERE oid='''||schema||'."'||spaceid||'"''::regclass) A';
268268
END IF;
269269
END;
270270
$BODY$
@@ -1150,7 +1150,7 @@ $BODY$
11501150
EXECUTE FORMAT ('DROP INDEX IF EXISTS %s."%s" ', schema, xyz_needless_manual_idx.idx_name);
11511151
END LOOP;
11521152

1153-
/** Check if auto-indexing is turend off - if yes, delete auto-indices */
1153+
/** Check if auto-indexing is turned off - if yes, delete auto-indices */
11541154
select auto_indexing from xyz_config.xyz_idxs_status into is_auto_indexing where spaceid = space;
11551155

11561156
IF is_auto_indexing = false THEN

0 commit comments

Comments
 (0)