Home / Companies / PlanetScale / Blog / August 2022

August 2022 Summaries

11 posts from PlanetScale

Filter
Month: Year:
Post Summaries Back to Blog
You can make schema changes in your production database without locking it, using online schema change tools like PlanetScale. Instead of applying changes directly to a table, you create a copy of the table (shadow table), apply the schema changes, get the data in sync between both tables, swap the tables atomically, and drop the old table. This process is non-blocking, meaning it won't lock your database during the schema change. PlanetScale handles this workflow for you with their branching feature, allowing you to make schema changes without downtime or data loss. The key is to run migrations on a development branch before deploying changes to production, ensuring that your application code doesn't write to the new schema until it's live in production. This approach simplifies the process of making schema changes and reduces stress for developers.
Aug 29, 2022 1,840 words in the original blog post.
Creating an empty database on PlanetScale allows for easy population with data from a script file, streamlining the process of managing large numbers of commands. To achieve this, users need to have a PlanetScale account and the CLI installed, as well as a script containing SQL commands. By utilizing the `pscale shell` command with the `<` operator, users can pipe in commands from their script file, creating a new database with a populated schema in a single step. Once created, users can interactively run queries on the database using the PlanetScale CLI.
Aug 25, 2022 396 words in the original blog post.
Our company has a lightweight and collaborative design process that doesn't follow rigid rules or have product managers. The company roadmap is determined by the leadership team working with engineering and product design to prioritize projects and explore possible solutions. Once a direction becomes clear, designers create high-fidelity mockups in Figma to share with team members, often building prototypes to identify friction points. Designers collaborate closely with engineers to move into code quickly, addressing structural and styling pieces while leaving the engineers with fill-in-the-blanks components. The company uses feature flags and checks to enable new features for specific people and teams before shipping to everyone, allowing employees to have high autonomy in their work and avoid traditional handoff processes.
Aug 22, 2022 527 words in the original blog post.
PlanetScale has introduced a serverless driver for JavaScript, which allows users to store and query data in PlanetScale from environments such as Cloudflare Workers, Vercel Edge Functions, and Netlify Edge Functions. The new driver uses secure HTTP connections, enabling high concurrent connection support and faster connections with TLS 1.3, connection multiplexing, and protocol compression. This update also brings global routing infrastructure to reduce latency drastically in situations where a client is connecting from a geographically distant location. To use the driver, users need to enroll their database into the beta features section of PlanetScale and install the package in their environment. The driver handles SQL sanitization to prevent security issues like SQL injection, making it suitable for serverless environments.
Aug 18, 2022 772 words in the original blog post.
We'd like to introduce FastPage, a new gem for ActiveRecord that applies the MySQL "deferred join" optimization to offset/limit queries. A slow pagination query in Rails was found to be 2.7x faster when using `fast_page`. The optimized technique works by first selecting the ID of all rows to show, then fetching the data for those rows, reducing the amount of data accessed and processed by the database. This gem is best used on pagination queries with an ORDER BY clause, particularly for deeper pages where performance benefits are most noticeable. It's recommended to test its effectiveness on your application's data to determine when it improves query times.
Aug 16, 2022 610 words in the original blog post.
We've built a Sidekiq client middleware to kill Sidekiq jobs in production without relying on deploys, using Flipper's feature flagging capabilities. We created a middleware that runs when pushing a job to Redis and short circuits any jobs that have been flagged for disablement. To use this middleware, we added it to our Sidekiq configurations and can now disable jobs by enabling the corresponding Flipper feature flag. This solution provides a more robust and immediate way to manage errant jobs in production.
Aug 15, 2022 357 words in the original blog post.
PlanetScale is a serverless MySQL-compatible database that aims to solve scalability challenges faced by backend web servers. It offers features such as intuitive developer workflows, advanced query monitoring, and the ability to instantly revert schema changes. By replacing traditional database upgrades with PlanetScale, developers can focus on optimizing their application's performance without worrying about provisioning new instances or increasing database capacity. The tutorial demonstrates how to set up a Django application to use PlanetScale, including connecting to the development branch, running migrations, adding data, and promoting to production.
Aug 11, 2022 931 words in the original blog post.
PlanetScale aims to bring DevOps practices to databases by introducing a new way of thinking about schema changes, deployment, and monitoring. The company's database is designed to be natively part of the DevOps process, allowing for automation, safeguards, and rollbacks. This enables faster product delivery, continuous integration, and reduced risk of downtime or data loss. By providing features such as database branches, CI/CD pipelines, deploy requests, and query monitoring, PlanetScale makes it possible to continuously deploy code and make schema changes without manual intervention. The goal is to bring the benefits of DevOps to databases, making them more agile and collaborative.
Aug 08, 2022 690 words in the original blog post.
Connecting a Python application to a MySQL database can be challenging due to various connection drivers and operating system compatibility issues. This article provides four methods to connect to a MySQL database using PlanetScale, a serverless database platform for MySQL, including mysqlclient, mysql-connector-python, PyMySQL, and aiomysql. The process involves setting up a free database on PlanetScale, generating connection credentials, and installing the required Python packages. Each method has similar syntax due to the Python database API specification, and examples are provided to demonstrate how to connect to MySQL using each driver, including handling SSL encryption for secure connections.
Aug 04, 2022 1,107 words in the original blog post.
PlanetScale is a highly available and scalable database solution that helps mitigate downtime caused by human error, system immaturity, and application issues. The platform uses Vitess, a mature database clustering system for horizontal scaling of MySQL, to ensure approachability while maintaining reliability and scalability. PlanetScale Insights provides real-time monitoring and analysis of queries to help identify performance issues and prevent outages. By building on a proven solution and continuously adding new tools and alerts, PlanetScale aims to deliver a high-performance scalable database that doesn't compromise developer experience.
Aug 02, 2022 649 words in the original blog post.
Rails applications at scale often encounter issues when deleting many records simultaneously due to associations between models. To mitigate these risks, consider using `dependent: :destroy_async` instead of foreign key constraints, which can lead to timeouts and excessive locking. Additionally, be aware of the difference between `delete` and `destroy`, as well as the importance of running validations from the parent model when using `destroy_async`. Finally, safely mass deleting old data by continuously running deletes in small batches, such as with a scheduled Sidekiq job, can help prevent unintended consequences to the rest of the application. By implementing these strategies, you can ensure cleaner data deletion and improve overall performance.
Aug 01, 2022 1,025 words in the original blog post.