Categories
Database postgres

Postgres: How Long does it take to DELETE a large amount of records and VACUUM FULL?

Sometimes there is table bloat on your postgres tables. A large amount of data that is stored that serves no purpose operationally. The large amount of data may hinder replication of data to other sources. One may decide to archive the data or just get rid of it if it is unneeded. How long does […]

Categories
postgres

Postgres: Querying Arrays

Quering tables that contain arrays can be tricky in postgres. The Postgres docs: Array functions provide a good explanation but it is good to practically run the queries and see the results. There is documention about arrays in general from postgres. Caveats: Array Types An important thing to note is that arrays being compared need […]

Categories
postgres

Postgres: Does Dropping Indexes and Foreign Keys before Inserts Really Work to Speed up Performance?

There is a use case where about 10000 records are inserted every few seconds after some processing. There was a suggestion that dropping indexes before the data insert would improve the speed of the inserts. The postgres docs recommend removing the indexes and foreign keys. Creating an index on pre-existing data is quicker than updating […]

Categories
postgres

Postgres and Django Case Sensitivity

Postgres queries are CaSeSensitivE unlike in MySQL. When a simple Model.objects.get(field=’hello’) would get the record. Using a postgres db you would need to use field__iexact=’hello’ Even unique doesn’t work with different cases with standard postgres. That is why django has the CIText Mixin and postgres has the citext extension. Could be a feature not a […]