Skip to content
This repository was archived by the owner on Jul 11, 2021. It is now read-only.

benchmarks #114

Open
megauspexx opened this issue Feb 18, 2021 · 2 comments
Open

benchmarks #114

megauspexx opened this issue Feb 18, 2021 · 2 comments

Comments

@megauspexx
Copy link

No description provided.

@megauspexx
Copy link
Author

Hello, i was interested in this extension. I would like to use it to calculate rank like this

select count(id) as count from data where (rating_sum > ? or (rating_sum = ? and p_id < ?) ) <more filters> .

What do you think about performance redisql vs mysql for this query?

Will redisql give more performance?
I tried using demo.redisql.com but for now connection refused

@siscia
Copy link
Collaborator

siscia commented Feb 18, 2021

Hi there,

yeah unfortunately I had to switch off the demo machine.

For your particular query, the engine doesn't really matter much.
As long as you have the correct indexes in place.

A composite index on rating_sum and p_id would already makes wonder for this particular query. Maybe it would be possible to find an even better index give the other filters.

The advantage of RediSQL is that you run it in memory. And you don't hit the disk. Then if your disk is fast enough this is not going to be a big issue.

Suggestion it is to try it and see if it goes fast enough for your use case.

Note of allert, this project is being discontinued in favor of zeesql, which is the version 2 of RediSQL.

More info on https://zeesql.com

What you can try is to start zeesql with docker, populate it with some data and see the performance. Something like:

$ docker run -d --name zeesql --rm redbeardlab/zeesql
$ docker exec -it zeesql redis-cli
> ZEESQL.CREATE_DB DB
> ZEESQL.EXEC DB COMMAND "create table data(rating_sum INT, p_id INT);"
> ZEESQL.EXEC DB COMMAND "INSERT INTO data VALUES (1,2),(2,3),(3,4);"
> ZEESQL.EXEC DB COMMAND "select count(id) as count from data where (rating_sum > ? or (rating_sum = ? and p_id < ?) ) <more filters>"

Of course, you will need more data to have reasonable numbers to compare!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants