How to Check Whether an Index is Hidden in MongoDB

From MongoDB 4.4, it’s possible to hide an index from the query planner. This allows you to evaluate the potential impact of dropping an index without actually dropping the index.

You can use the getIndexes() method to check whether or not an index is hidden. If an index is hidden, that index will display a hidden field as having a value of true (i.e. "hidden" : true).

Continue reading

How to Reference JSON Keys that Contain Special Characters when using OPENJSON, JSON_QUERY, and JSON_VALUE (SQL Server)

If you’re using a T-SQL function such as OPENJSON(), JSON_QUERY(), or JSON_VALUE(), you might be wary of any non-alphanumeric characters that might be in the JSON document that you’re working with. Especially if those special characters are in the key names, and you need to reference those key names.

Continue reading

3 Ways to Hide an Index from the Query Plan in MongoDB

Starting from MongoDB 4.4, we can now hide indexes from the query plan. This enables us to evaluate the potential impact of dropping an index without actually dropping the index.

If hiding it has a negative impact, we can unhide the index. This saves us from having to drop the index, then recreate it again.

Below are 3 ways to hide an index in MongoDB.

Continue reading

3 Ways to Show the Collation for your Connection in MariaDB

When you run a query against a MariaDB database, MariaDB uses a bunch of system variables to determine which character set and collation to use whenever queries are run. If the client uses a different character set to the server, then MariaDB can translate it into an appropriate character set and collation.

When sending the query results back to the client, MariaDB can translate these results back to a different character set altogether if required. MariaDB uses system variables to determine which character sets and collations to use at each of these steps.

Here are three ways to show the connection collation in MariaDB.

Continue reading