NoSQL Workbench support for Local Secondary Indexes in Dynamodb - nosql

Is there a way to add a local secondary index to a new Dynamodb table definition in NoSQL Workbench (v3.3.0 on macos)?
I am able to configure global secondary indexes but nothing for local.

There is not. In general using LSIs are discouraged because they limit scalability, with their only benefit being they provide strong consistency on the index.

Related

Which is a more efficient way to implement database sharding, PostgreSQL's foreign data wrappers? or multiple unrelated Postgres instances?

One way of implementing database sharding in postgresql 11 is partitioning the table and then using the foreign data wrapper to set it up so that the shards are running on their own containers. read more here
what you get with this approach is that you only deal with one database.
another way of implementing database sharding in postgresql 11 is basically running multiple instances of postgres and handling all the sharding logic using code. for example, having an extra field in the data table titled sharding_id which we can use to decide which instance we need to query to retrieve the data. if the sharding id is 1 then query instance 1.
which of these approaches is better in terms of performance?
This question would be as unanswerable as "what is better: PostgreSQL or Oracle", if sharding with foreign data wrappers were functional.
Alas, sharding by foreign data wrapper doesn't work yet. The missing link is that currently (v13), PostgreSQL cannot scan partitions that are foreign tables in parallel.

Is there any performance impact to have multiple Mongo databases?

We are currently working on an application using Mongo and we try to evaluate benefits and constraints on each differents architecture choices related to spreading data on multiple databases/collections or using a single shared one.
Is there any performance penalties between one single database with a lot of collections or many databases with less collections per database ?
From what I understand it does not seem to have any impact because sharding is done per collection basis but I would like some confirmations.
Regards
By performance, I guess you mean read/write speed. Using multiple databases with fewer collections would definitely increase your read/write speed since each database can handle more read/write operations on the collections associated with them. 
However, spreading data across databases this way I believe can bring about extra complexity to your project, depending on how your codebase is structured, it might introduce complexity to your application logic, things like backup and other admin database operations won't be straight forward, cross collection ad-hoc queries for collection that lives in different databases would be next to impossible.
If the goal of the architecture design is to ensure high read/write speed, you can still go with using a single DB that can be auto-scaled at the deployment level. I don't know much about it but I think Replication is a MongoDB feature that can help you achieve such auto-scaling and if you are in for database-as-a-service, you should check out MongoDB Atlas, auto-scaling is out of the box.

MongoDB - Is there any advantage in moving frequently updated fields to different collections?

I'm new to MongoDB and Document-Oriented Databases and while I was migrating a relational database to this whole new concept of storing a question raised:
In relational databases it's usually a good idea to create a new table to store frequently updated fields (let's say you have a user's table and a last_activity one) so that the slow write operations don't lock the other tables.
Is there any advantage of doing the same in MongoDB, since the read operations seem to be very performant and doing two queries wouldn't be much of a problem?
Thank you all in advance.
Starting with version mongodb 3.2, is already in use by default wiredtiger. This engine is not necessary to create additional collections.
Well, do not forget to create updatable fields Index.
db.test.ensureIndex({name: 1});
db.test.update({"name":"Alex"}, {$set:{"last_name":"alexeev"}})
If you use the default storage engine, MMAPv1, then you have collection-level concurrency and it may be beneficial to create new collections for frequently updated fields.
However, the WiredTiger storage engine has document-level concurrency and there is no need to create additional tables.
https://docs.mongodb.org/v3.0/core/wiredtiger/

Using a Database vs a Collection in MongoDB

I am building a site with users who have discussions and write blogs and plan to use MongoDB as the database for the site. Which architecture option would be more efficient and allow for easier data flow between them:
One Database with a Blogs Collection, a Discussions Collection, and a User Activity Collection? Each collection would be sharded as appropriate.
A Blogs Database, a Discussions Database, and a User Activity Database? Each database would be broken into collections and sha rded as appropriate.
It won't make a big difference whether you put everything into a single database or into multiple databases until you find you need to do something that's handled on the database level, for example access control, or placing database files on separate physical devices (to reduce I/O contention).
In addition, currently locking granularity is on the database level so if you happen to have a very large number of small writes having them go to different databases will mean that they will not be contending for the same lock. Since you anticipate sharding you can also place each database on a different shard which may allow you to defer actually needing to shard any particular collection as each shard would only be handling the traffic for that database's collection(s).
I would say if you are in doubt go ahead and put them in separate databases, it's unlikely to hurt and it may help.
Mongo will work, but getting familiar with it may take time depending on your experience.
If you use MySQL (or another SQL db) you may have an easier time. You should probably just create separate tables for your blogs, discussions, and activity, rather than multiple databases.
Another factor to consider is the size of your databases. An SQL database is fine for most applications, even fairly large ones. MongoDB (and other NoSQL db's) are great for scaling big data.
Hope this helps!

creating a different database for each collection in MongoDB 2.2

MongoDB 2.2 has a write lock per database as opposed to a global write lock on the server in previous versions. So would it be ok if i store each collection in a separate database to effectively have a write lock per collection.(This will make it look like MyISAM's table level locking). Is this approach faulty?
There's a key limitation to the locking and that is the local database. That database includes a the oplog collection which is used for replication.
If you're running in production, you should be running with Replica Sets. If you're running with Replica Sets, you need to be aware of the write lock effect on that database.
Breaking out your 10 collections into 10 DBs is useless if they all block waiting for the oplog.
Before taking a large step to re-write, please ensure that the oplog will not cause issues.
Also, be aware that MongoDB implements DB-level security. If you're using any security features, you are now creating more DBs to secure.
Yes that will work, 10gen actually offers this as an option in their talks on locking.
I probably isolate every collection, though. Most databases seem to have 2-5 high activity collections. For the sake of simplicity it's probably better to keep the low activity collections grouped in one DB and put high activity collections in their own databases.