# IC SQL Lite Real Users Report

**URL:** <https://forum.dfinity.org/t/ic-sql-lite-real-users-report/21307>\
**Category:** Developers\
**Created:** [July 12, 2023, 2:43am UTC](https://forum.dfinity.org/t/ic-sql-lite-real-users-report/21307 "2023-07-12T02:43:06Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![josephgranata](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/josephgranata/32/21930_2.png) [@josephgranata](https://forum.dfinity.org/u/josephgranata)\
**Post date:** [July 12, 2023, 2:43am UTC](https://forum.dfinity.org/t/ic-sql-lite-real-users-report/21307/1 "2023-07-12T02:43:06Z")

</div>

We are evaluating the only open source database we have seen ported to the IC, that would be SQLite.

Is anyone using it, has anyone been able to see how it works on production?

FYI The folks at FrogHubIo, a Chinese blockchain firm released it without much fanfare here on the forum, since then I haven’t heard much. Their code is here:

> **[GitHub - froghub-io/ic-sqlite: Using sqlite on an internet computer(ICP)](https://github.com/froghub-io/ic-sqlite)**
>
> Using sqlite on an internet computer(ICP). Contribute to froghub-io/ic-sqlite development by creating an account on GitHub.

I did notice @lastmjs company seems to be using it, at least that is what Github says for their TypeScript compatible language. Jordan can you share an experience report? Have you used it for a real life application?

If anyone else has built anything on IC SQLite we would appreciate knowing more about it.

Thanks!

P.S. We are aware of CanDB but would prefer a simple MIT License or equivalent, this is CanDB’s license: [https://github.com/ORIGYN-SA/CanDB/blob/beta/license.md](https://github.com/ORIGYN-SA/CanDB/blob/beta/license.md)

---

<div class="post-metadata">

**Author:** ![domwoe](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/domwoe/32/5165_2.png) [@domwoe](https://forum.dfinity.org/u/domwoe)\
**Post date:** [July 12, 2023, 7:29pm UTC](https://forum.dfinity.org/t/ic-sql-lite-real-users-report/21307/2 "2023-07-12T19:29:00Z")

</div>

@infu did some experiments with it as well.

@FroghubMan Do you know of any other users?

---

<div class="post-metadata">

**Author:** ![lastmjs](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/lastmjs/32/3406_2.png) [@lastmjs](https://forum.dfinity.org/u/lastmjs)\
**Post date:** [July 13, 2023, 12:35am UTC](https://forum.dfinity.org/t/ic-sql-lite-real-users-report/21307/3 "2023-07-13T00:35:30Z")

</div>

We just built a demo for Azle’s plugin system, @infu is the one using it (I believe).

---

<div class="post-metadata">

**Author:** ![icpp](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/icpp/32/9310_2.png) [@icpp](https://forum.dfinity.org/u/icpp)\
**Post date:** [July 13, 2023, 1:58am UTC](https://forum.dfinity.org/t/ic-sql-lite-real-users-report/21307/4 "2023-07-13T01:58:31Z")

</div>

@josephgranata ,  
Out of curiosity, what type and amount of data will you be storing?

Would it fit in a single canister?

---

<div class="post-metadata">

**Author:** ![josephgranata](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/josephgranata/32/21930_2.png) [@josephgranata](https://forum.dfinity.org/u/josephgranata)\
**Post date:** [July 13, 2023, 2:06am UTC](https://forum.dfinity.org/t/ic-sql-lite-real-users-report/21307/5 "2023-07-13T02:06:56Z")

</div>

Thanks Jordan, so no real stress test in production.

---

<div class="post-metadata">

**Author:** ![josephgranata](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/josephgranata/32/21930_2.png) [@josephgranata](https://forum.dfinity.org/u/josephgranata)\
**Post date:** [July 13, 2023, 2:08am UTC](https://forum.dfinity.org/t/ic-sql-lite-real-users-report/21307/6 "2023-07-13T02:08:44Z")

</div>

Yes, for our use case the data could fit in a single canister, and that is why we are exploring using Rust and Stable Structures, but when you do that you have no query language, and no easy way to organize data, it’s all traversing a data structure manually.

So it would still be advantageous to have a real database instead of a data structure 😉

---

<div class="post-metadata">

**Author:** ![infu](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/infu/32/11321_2.png) [@infu](https://forum.dfinity.org/u/infu)\
**Post date:** [July 13, 2023, 9:00am UTC](https://forum.dfinity.org/t/ic-sql-lite-real-users-report/21307/7 "2023-07-13T09:00:33Z")

</div>

It works well.  
Here is a demo I made with Sqlite and Azle - which uses a Rust plugin and Froghubs library  
[https://github.com/infu/internetbase-sql-demo](https://github.com/infu/internetbase-sql-demo)  
The goal was to see how well it will perform in a real-world scenario.  
Everything on that site works until you insert 300,000 rows into the ‘services’ table and run a query using three indexes. If you work with one index your table can probably use the whole stable memory. When you add two, you are going down to 1mil and 3 indexes 300k. The reason is SQLite has to go around the stable memory and fetch a lot of pages before it finds your rows and you run out of instructions.  
Dfinity is working on a stable memory cache, which will put the most used pages in the heap and that will probably cache the indexes and improve performance.  
You can also change the library to store indexes in the heap, won’t be easy, but it’s doable in theory.

---

<div class="post-metadata">

**Author:** ![infu](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/infu/32/11321_2.png) [@infu](https://forum.dfinity.org/u/infu)\
**Post date:** [July 13, 2023, 9:22am UTC](https://forum.dfinity.org/t/ic-sql-lite-real-users-report/21307/8 "2023-07-13T09:22:34Z")

</div>

We’ve also made RxMoDB [https://forum.dfinity.org/t/rxmodb-database-v-0-1-0/21076](https://forum.dfinity.org/t/rxmodb-database-v-0-1-0/21076)  
that can carry out some SQL-like queries  
[![](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/7/7d1afbf9687e46af9b33ee867bb23f3d4e23f397.png) ](https://us1.discourse-cdn.com/flex023/uploads/dfn/original/2X/7/7d1afbf9687e46af9b33ee867bb23f3d4e23f397.png)  
Essentially SQL indexes are Btrees. For a lot of use cases, you won’t need all the SQL features and you will prefer having greater control. RxMoDb is a single canister and currently just takes care of maintaining your indexes. It worked well with 10mil documents/rows and 2 indexes. It’s safe to say if you are growing a new app you won’t run into the limits (unless you are making a free-to-play game or using an existing userbase). IC is getting better and faster every month and it will probably cover you.

---

<div class="post-metadata">

**Author:** ![josephgranata](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/josephgranata/32/21930_2.png) [@josephgranata](https://forum.dfinity.org/u/josephgranata)\
**Post date:** [July 13, 2023, 5:14pm UTC](https://forum.dfinity.org/t/ic-sql-lite-real-users-report/21307/9 "2023-07-13T17:14:39Z")

</div>

> [@infu](#):
>
> [RxMoDb - Database v.0.1.0](https://forum.dfinity.org/t/rxmodb-database-v-0-1-0/21076)

Thanks for the news, and for the link.

It seems then that we have a small database.

I will test it for sure!

---

<div class="post-metadata">

**Author:** ![josephgranata](https://sea1.discourse-cdn.com/flex023/user_avatar/forum.dfinity.org/josephgranata/32/21930_2.png) [@josephgranata](https://forum.dfinity.org/u/josephgranata)\
**Post date:** [July 13, 2023, 5:21pm UTC](https://forum.dfinity.org/t/ic-sql-lite-real-users-report/21307/10 "2023-07-13T17:21:30Z")

</div>

This is very interesting, perhaps a reason for us to consider Motoko.

Or perhaps we will consider porting it to Rust… we shall see.

Thanks again @infu, one thing is clear, the solution to the database problem is near, and it’s partially here.

I would still prefer to just run a database, and not worry about intercanister calls, and message ingress limits, and the like, but I must admit, it’s indeed getting better.
