Skip to content

Instantly share code, notes, and snippets.

View ioguix's full-sized avatar

Jehan-Guillaume (ioguix) de Rorthais ioguix

View GitHub Profile
@ioguix
ioguix / btree_bloat-7.4.sql
Last active August 29, 2015 14:08
B-tree index bloat estimation for PostgreSQL 7.4
/* The bloat estimation queries moved to this respository:
* https://github.com/ioguix/pgsql-bloat-estimation
*/
@ioguix
ioguix / table_bloat-74-81.sql
Last active August 29, 2015 14:06
Table bloat estimation for PostgreSQL 7.4 to 8.1
/* The bloat estimation queries moved to this respository:
* https://github.com/ioguix/pgsql-bloat-estimation
*/
@ioguix
ioguix / table_bloat-82-84.sql
Last active August 29, 2015 14:06
Table bloat estimation for PostgreSQL 8.2 to 8.4
/* The bloat estimation queries moved to this respository:
* https://github.com/ioguix/pgsql-bloat-estimation
*/
@ioguix
ioguix / table_bloat.sql
Last active August 29, 2015 14:06
Table bloat estimation for 9.0 and more
/* The bloat estimation queries moved to this respository:
* https://github.com/ioguix/pgsql-bloat-estimation
*/
@ioguix
ioguix / btree_bloat-8.0-8.1.sql
Last active August 29, 2015 14:04
B-tree index bloat estimation for PostgreSQL 8.0 to 8.1
/* The bloat estimation queries moved to this respository:
* https://github.com/ioguix/pgsql-bloat-estimation
*/
@ioguix
ioguix / btree_bloat.sql
Last active March 28, 2018 18:12
B-tree index bloat estimation
/* The bloat estimation queries moved to this respository:
* https://github.com/ioguix/pgsql-bloat-estimation
*/
@ioguix
ioguix / 8.3 operator workaround.sql
Created June 2, 2014 15:28
Workaround using operators to implicit cast removed in PostgreSQL 8.3
CREATE FUNCTION pg_catalog.texteqint(text, integer) RETURNS BOOLEAN STRICT IMMUTABLE LANGUAGE SQL AS $$SELECT textin(int4out($2)) = $1;$$;
CREATE FUNCTION pg_catalog.texteqint2(text, smallint) RETURNS BOOLEAN STRICT IMMUTABLE LANGUAGE SQL AS $$SELECT textin(int2out($2)) = $1;$$;
CREATE FUNCTION pg_catalog.texteqoid(text, oid) RETURNS BOOLEAN STRICT IMMUTABLE LANGUAGE SQL AS $$SELECT textin(oidout($2)) = $1;$$;
CREATE FUNCTION pg_catalog.texteqdate(text, date) RETURNS BOOLEAN STRICT IMMUTABLE LANGUAGE SQL AS $$SELECT textin(date_out($2)) = $1;$$;
CREATE FUNCTION pg_catalog.texteqfloat8(text, double precision) RETURNS BOOLEAN STRICT IMMUTABLE LANGUAGE SQL AS $$SELECT textin(float8out($2)) = $1;$$;
CREATE FUNCTION pg_catalog.texteqreal(text, real) RETURNS BOOLEAN STRICT IMMUTABLE LANGUAGE SQL AS $$SELECT textin(float4out($2)) = $1;$$;
CREATE FUNCTION pg_catalog.texteqtimetz(text, time WITH time zone) RETURNS BOOLEAN STRICT IMMUTABLE LANGUAGE SQL AS $$SELECT textin(timetz_out($2)) = $1;$$;
CREATE FUNCTION pg_cata