We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
See article https://habr.com/ru/companies/tensor/articles/488104/ Part "Плохо: много и не к месту (timestamp «в середине»)"
WITH sch AS ( SELECT 'public'::text sch -- schema ) , def AS ( SELECT clr.relname nmt , cli.relname nmi , pg_get_indexdef(cli.oid) def , cli.oid clioid , clr , cli , idx , ( SELECT array_agg(T::text ORDER BY f.i) FROM ( SELECT clr.oid rel , i , idx.indkey[i] ik FROM generate_subscripts(idx.indkey, 1) i ) f JOIN pg_attribute T ON (T.attrelid, T.attnum) = (f.rel, f.ik) ) fld$ , ( SELECT array_agg(replace(opcname::text, '_ops', '') ORDER BY f.i) FROM ( SELECT clr.oid rel , i , idx.indclass[i] ik FROM generate_subscripts(idx.indclass, 1) i ) f JOIN pg_opclass T ON T.oid = f.ik ) opc$ FROM pg_class clr JOIN pg_index idx ON idx.indrelid = clr.oid JOIN pg_class cli ON cli.oid = idx.indexrelid JOIN pg_namespace nsp ON nsp.oid = cli.relnamespace AND nsp.nspname = (TABLE sch) WHERE NOT idx.indisunique AND idx.indisready AND idx.indisvalid ORDER BY clr.relname, cli.relname ) , fld AS ( SELECT * , ARRAY( SELECT (att::pg_attribute).attname FROM unnest(fld$) att ) nmf$ , ARRAY( SELECT ( SELECT typname FROM pg_type WHERE oid = (att::pg_attribute).atttypid ) FROM unnest(fld$) att ) tpf$ FROM def ) SELECT nmt , nmi , def , nmf$ , tpf$ , opc$ FROM fld WHERE 'timestamp' = ANY(tpf$[1:array_length(tpf$, 1) - 1]) OR 'timestamptz' = ANY(tpf$[1:array_length(tpf$, 1) - 1]) OR 'timestamp' = ANY(opc$[1:array_length(opc$, 1) - 1]) OR 'timestamptz' = ANY(opc$[1:array_length(opc$, 1) - 1]) ORDER BY 1, 2;
Need to rewrite query Need to test with date_trunc in index
date_trunc
The text was updated successfully, but these errors were encountered:
No branches or pull requests
See article https://habr.com/ru/companies/tensor/articles/488104/
Part "Плохо: много и не к месту (timestamp «в середине»)"
Need to rewrite query
Need to test with
date_trunc
in indexThe text was updated successfully, but these errors were encountered: