Tag: PostgreSQL
Primary Key Index is a Space Hog
Tables in PostgreSQL have an index for the primary key and separate row storage called the heap. Other databases integrate these together or support “index-organized tables”. In this arrangement, the primary key lookup process leads directly to the row data without a secondary fetch to get the full row and the requisite additional CPU and…
Monitor PostgreSQL using Zabbix
Would you like to learn how to monitor a PostgreSQL server using Zabbix? In this tutorial, we are going to show you how to use Zabbix to monitor a PostgreSQL server. Zabbix Playlist: On this page, we offer quick access to a list of videos related to Zabbix installation. Playlist Don’t forget to subscribe to our youtube…
How To Install PostgreSQL With Docker Quickly
Many developers still install a database on their computer and work on it. It may be a preferable method, but using Docker takes only seconds to set up a database. I used PostgreSQL and Docker in my latest project. As a result, I have achieved efficiency and convenience. I will give you my experience with…
Mi .psqlrc
Coleccion de cositas para el .psqlrc ————————————————– — 20200115 DAF agrego funcionalidades — 20200108 DAF .psqlrc Version inicial ————————————————– — Para que no muestre el output de los siquientes comandos \set QUIET ON — Prompts — Prompt1 / Prompt2 / Prompt3 — %M : server — %m : host name — %> : port –…
Foreign data wrappers en Postgres
Quien no se encontro alguna vez con la necesidad de traer algun dato desde un SQL Server a un Postgres…??? Bien, tenia esto: Un postgres 9.6.5 y un SQL Server 2014 SP2 (12.0.5207.0) todo en 64bits. Y supongamos que tambien tienen un usaurio y clave del SQL Server, asi como el nombre de la tabla,…
pgAdmin 4 v1.1, pros y contras.
El pgAdmin III, tiene sucesor, un completamente nuevo pgAdmin 4 que por desgracia esta muuuuuuuuy verde. Lo pueden encontrar en su sitio: pgadmin.org Pros: Soporta v9.6 Una vez conectado el arbol carga rapido. Contras: No tiene buscar (ctrl+F), reemplazar, nuevo (ctrl+N; (ctrl+E)) No podes importar los servidores registrados en el PGAdmin 3 No podes cambiar…
Datazo V
SELECT unnest(string_to_array(‘1,2,3,4’, ‘,’)) un string lo transformas a un array y el unnest te lo pone en filitas… bien tecnico Saludos,
DATAZO IV – Modulo PG_TRGM
La única función que analice de acá fue la “similarity”. En XXXX la estamos usando para buscar PABLO PEREZ o PEREZ PABLO, independientemente como lo escriban te lo trae… https://www.postgresql.org/docs/current/static/pgtrgm.html Muy útil, y resuelve bastante rápido.- Saludos,
Como ver el estado del servidor postgressql sin ser superuser
CREATE FUNCTION get_sa() RETURNS SETOF pg_stat_activity AS $$ SELECT * FROM pg_catalog.pg_stat_activity; $$ LANGUAGE sql VOLATILE SECURITY DEFINER; CREATE VIEW pg_stat_activity_allusers AS SELECT * FROM get_sa(); GRANT SELECT ON pg_stat_activity_allusers TO public; select * from pg_stat_activity_allusers;
DATAZO III – Funciones de string en Postgres, conocidas y desconocidas
n buen resumen de muchisimas funciones de strings, conocidas y desconocidas: http://postgresql-backup.com/postgresql-blog/postgres-string-functions/ Todo en un PDF: http://postgresql-backup.com/postgresql-blog/wp-content/uploads/2016/06/PostgreSQL-Cheat-Sheet_-String-Functions.pdf Por ejemplo, cómo parsear un string separado por comas: SPLIT_PART (‘1,2,3’, ‘,’, 2) = ‘2’ cómo rellenar con ceros: LPAD (‘123’, 6, ‘0’) = ‘000123’ cómo escribir con iniciales mayusculas: INITCAP (‘hi thomas’) = ‘Hi Thomas’ etc, etc…
Postgres Datazo II
Ayer Leo necesitaba corregir un sp de XXXX en Produccion. Me pidio por mantis corregirlo una vez, lo ejecutó y tuvo otro error. Me pidio por mantis corregirlo otra vez, lo ejecutó y tuvo otro error. A la tercera me pide permiso para alterar el sp. Puse el sp como propiedad ya no del usuario…
Datazo
Recién tuve que hacer un insert masivo de registros borrados por error (desde Chaco) sobre una tabla de Prevencion PROD que tiene TRIGGGERS. Tomé los registros de un backup y los inserté pero NO QUIERO QUE SE DISPARE EL TRIGGER yaa que los registros “siempre estuvieron alli y no cambiaron”. Deshabilitar el trigger de la…