droidcon NYC 2017 - The Resurgence of SQL
HTML-код
- Опубликовано: 1 дек 2024
- Jake Wharton, Google & Alec Strong, Square, Inc.
SQL may have fallen out of fashion over the last decade, but libraries like SQL Delight and Room are now placing it at the forefront of their use. As a language, SQL is more declarative and expressive than any ORM could hope to be. With the support of strong tooling, database interactions not only become easier but you're able to leverage more of its power. This talk will be a re-introduction to the SQL language for those that have seen it before. We will focus on specific examples where you can offload work that would have otherwise been done in code into the database. Finally, we'll compare and contrast the SQL Delight and Room libraries.
goo.gl/YKEx1x
droidcon NYC - droidcon.nyc
*********************************************
droidcon NYC has become an event where the American and International Android development and design community come together to share what’s new and what they’ve been working on. Our goal is to serve the community and move the Android platform forward.
Organized by droidcon - www.droidcon.com/
*********************************************
droidcon is the largest global network of developer conferences which bring together the industry's foremost experts dedicated to advancing the Android platform. droidcon engages a global network of over 25,000 developers attending our events in 26 countries.
Content by touchlab - touchlab.co
*********************************************
droidcon NYC content organized by Kevin Galligan, President of touchlab
Android and iOS Mobile App Development / Doppl Open Source Code Sharing Platform / Mobile Innovation Advisory / UIUX Design. Our goal is to keep growing our company by serving the community. Stop by our next meetup: www.meetup.com...
Big thanks to our video sponsors:
American Express - jobs.americane...
mParticle - www.mparticle....
I can't imagine a better overview of SQLite and ORMs given in 40 minutes. Simply outstanding!
The only piece of information missing (probably due to time constraints) is that SQLite is transactional database, and the default transaction mode on Android is EXCLUSIVE.
The implications is that even if you optimize the queries to run very quickly, but the query is being executed while a long running transaction is in progress - the query will wait for the transaction to complete. This can lead to super-optimized queries still taking many seconds to complete just because they are waiting.
This scenario is especially important to handle properly if you implement offline support using a framework that manages synchronization attempts with the server (SyncAdapter, JobScheduler, etc.).
If you are using WAL mode that's not a problem.
Also the way to workaround that issue if not using WAL, is to not have long running write transactions by aggregating all data in memory and then commit it to db in one transaction.
I was working on Email app with full offline support (offline-first) and this worked great.
you probably dont give a shit but does any of you know a method to get back into an Instagram account?
I was stupid lost the login password. I would appreciate any assistance you can offer me!
why was friend2 not indexed, if it's part of the primary key?
Good question! Because its a composite primary key, the order you declare the primary key in matters. In our case we did PRIMARY KEY (friend1, friend2) which means it indexes (essentially sorts) the friend1 column, and then for rows which have the same friend1, it sorts friend2 after. So only friend1 is sorted over the whole table, friend2 is just sorted for rows with the same friend1.
If we instead declared the primary key as PRIMARY KEY (friend2, friend1), then the opposite happens. friend2 is sorted for the whole table so when we EXPLAIN QUERY PLAN, the query against friend2 is a search using our primary key index.
object database == realm ?
correct
But relationships!
😍
Jaav-u