TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Support for indexes that use deterministic expressions

65 pointsby mingodadover 9 years ago

5 comments

mingodadover 9 years ago
Example using the json1 extension:<p>BEGIN TRANSACTION;<p>CREATE TABLE json_tbl(id integer primary key, json text collate nocase); CREATE VIEW json_tbl_view AS SELECT id, json_extract(json, &#x27;$.value&#x27;) AS val FROM json_tbl;<p>CREATE INDEX json_tbl_idx on json_tbl(json_extract(json, &#x27;$.value&#x27;));<p>EXPLAIN QUERY PLAN SELECT * FROM json_tbl_view WHERE &#x27;the_value_33&#x27; = val;<p>COMMIT;
JohnBootyover 9 years ago
If I understand correctly and this is similar to Postgres&#x27; functionality, this is really awesome for any calculated value (particularly anything expensive) that you frequently need to search on.<p>It makes inserts and updates more expensive, because the calculated values must be recalculated, but it can be an awesome win.<p>Hooray SQLite!
ThePhysicistover 9 years ago
SQLite gets better and better all the time. Considering that hard disks and memories get faster and cheaper as well SQLite is even becoming a serious option for handling &quot;big data&quot;.<p>I use it in several of my personal and professional projects, especially in cases where data can be sharded well. The one thing that is a bit annoying though is the locking mechanism in SQLite, which prevents simultaneous writes to the database and locks it for reading while a write transaction is underway. If they could find a way to improve that behavior I think the use cases of SQLite would grow way beyond embedded application databases. Whether or not this is a good thing is of course a different question, but having a zero-configuration &quot;plug-and-play&quot; database engine could be a very attractive proposition to many people.<p>BerkeleyDB for example, which handles concurrent access much better than SQLite and also comes in a high-availability version is used in many production environments today, most notably as the backend of Amazon&#x27;s DynamoDB key&#x2F;value store.
评论 #10174972 未加载
评论 #10174946 未加载
评论 #10175240 未加载
评论 #10178060 未加载
aw3c2over 9 years ago
I really wish things like blog and forum software would use sqlite more often. It makes installation and backup trivial while being good enough for the vast majority of cases.
mappuover 9 years ago
That puts it one (more) step ahead of MySQL, which still doesn&#x27;t support function indexes in 5.6.