December 2022 Summaries
5 posts from PlanetScale
Filter
Month:
Year:
Post Summaries
Back to Blog
The process of choosing the right indexes to use, and the right order to fetch data in, is called query planning. Query planning involves analyzing the input SQL code, breaking it down into a sequence of tokens, checking for semantic errors, optimizing the query plan, and generating an executable plan that specifies the steps the database engine should take to execute the query. The optimization phase is crucial as it determines the most efficient way to execute the query, considering factors such as available indexes, data distribution, and overall structure of the database. A good query planner can significantly impact the performance and efficiency of databases, making it an essential component of database management systems.
Dec 15, 2022
1,481 words in the original blog post.
In the context of Temporal, a deterministic workflow processing framework, determining the appropriate persistence layer is crucial. PlanetScale, built on top of Vitess, provides a scalable solution for sharding MySQL databases without sacrificing operational complexity. By leveraging horizontal partitioning and VTGate, PlanetScale delivers resiliency, scalability, and performance improvements over a single MySQL instance. The vSchema abstraction layer presents a unified view of the underlying keyspaces and shards, enabling seamless sharding and minimizing disruption to applications. In contrast to other NoSQL bindings for Temporal, PlanetScale's approach reduces potential failure points and increases write and read throughput, making it an attractive option for production environments. By adopting PlanetScale, users can take full advantage of its scalability improvements while maintaining operational simplicity.
Dec 14, 2022
1,448 words in the original blog post.
Rails provides several tools to protect against common issues such as mass assignment, N+1 queries, and credential protection. Mass assignment protection is achieved through strong parameters, which allow developers to specify which attributes are allowed to be passed to the controller. Strong parameters can be defined at both the model and controller levels, providing flexibility in how they are used. Rails also provides a mechanism for detecting down N+1s through strict loading, which raises an error if the association is lazily loaded. This helps prevent performance issues with large datasets. Credential protection is achieved through the use of encrypted YAML files stored in the application's configuration directory. These files can be accessed using the `credentials` method on Rails applications. Additionally, Rails provides several mechanisms for preventing unwanted emails from being sent during development, including turning off email delivery, changing the delivery method, and intercepting all emails sent in development.
Dec 12, 2022
2,927 words in the original blog post.
The current challenge in deploying a fast and responsive Rails application is not only optimizing queries, caching views, and reducing network latency between users and servers, but also ensuring that the database can be replicated across multiple regions to reduce latency. To achieve this, developers need to set up multi-region databases with read-only replicas, configure connections to these replicas, and implement automatic connection switching to direct reads to the nearest replica. Additionally, they must address potential issues such as replication lag and reading one's own writes by leveraging Rails middleware and selectively connecting to the closest database replica based on the application's region.
Dec 08, 2022
1,036 words in the original blog post.
To secure sensitive information such as connection strings in an AWS-based application, developers can use the AWS Key Management Service (KMS) to encrypt environment variables. This approach ensures that even if unauthorized users gain access to the codebase or AWS account, they cannot access the encrypted data. The process involves creating a Lambda function, setting up environment variables with KMS encryption, and updating the code to decrypt the connection string using the KMS key. By following these steps, developers can significantly improve the security of their applications built on AWS.
Dec 07, 2022
2,146 words in the original blog post.