:::: MENU ::::

Posts Categorized / Database

  • Nov 07 / 2016
  • 0

PostgreSQL – Check value is in array

With PostgreSQL, if you have a field containing an Array and you want to get all the results containing this value in the array, you can use the following command.

Here, we are looking for all the results in the table my_table containing my_value in the field my_array.

  • Aug 11 / 2016
  • 0

Calculate Database/Table size in MySQL

MySQL is an open-source relational database management system (RDBMS) available under the terms of the GNU General Public License, as well as under a variety of proprietary agreements.

Thanks to some few functions, it’s possible to retrieve important information about database size and/or table size for a MySQL instance.

Size for all databases

Size of tables for a specific database

For a complete documentation, please refer to the official documentation on their website https://www.mysql.com

  • Jan 11 / 2016
  • 0

Increase display limit for a find in Mongo Shell

When doing a find request on a Shell Mongo, the display is automatically paginated and you’re getting this:

By default, the number of rows returned is 20. But this value can easily be changed by using this command:

You will now have 200 rows displayed per page.

  • Dec 24 / 2015
  • 0

Manage permissions on MySQL for remote users

MySQL has always been one of the most used database engine for websites. Its security is really important, isolating and managing access must be taken in consideration.

Hereafter are some commands to perform some checking and some updates.
I will consider those variables for my examples, but you should customize them with your own:

  • Show permissions for user myuser on server myfirewalleddomain.local :
  • Revoke all privileges on my_db for user myuser on server myfirewalleddomain.local :
  • Grant access for SELECT on my_db for user myuser on server myfirewalleddomain.local with a password:
  • Grant all privileges on my_db for user myuser on server myfirewalleddomain.local with a password:
  • Nov 26 / 2015
  • 0

Gather/Aggregate results with MongoDB

Need to gather or aggregate some results with MongoDB? Easy!

You can use the group command over any collection to get a nice display of your results aggregated:

You will get something like:

Here you are!

  • May 03 / 2014
  • 0

Find PostgreSQL database size

PostgreSQL is an object-relational database management system (ORDBMS). It’s a free and open-source tool available under BSD licence.

Thanks to some built-in functions, you can get several information regarding database and/or table size. You will find below the main and most used examples.

Database size (in octal)

Database size (in human understandable format)

All databases size

Table size (excluding indexes and some auxiliary data)

Table size (including all data)

Find the largest table in database

 For the full documentation, please visit http://www.postgresql.org/

Question ? Contact