-
Notifications
You must be signed in to change notification settings - Fork 91
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cockroachDB extremely long query due to Array(UUID()) #1005
Comments
Another interesting note:
|
@Jacky56 You are doing everything right on the table definition and querying Piccolo. I think the problem is how |
@sinisaos Thanks for looking into this. Hopefully |
hello @sinisaos @dantownsend Is there a way to change im running piccolo on a container and cold starting the service takes criminially long because of what sinisa pointed out |
@Jacky56 import uuid
from piccolo.table import Table
from piccolo.columns import Array, Text, ForeignKey, UUID, Varchar
from psqlpy_piccolo import PSQLPyEngine
DB = PSQLPyEngine(
config={
"host": "localhost",
"database": "piccolo",
"user": "root",
"password": "",
"port": 26257,
}
)
def generate_uuid():
return str(uuid.uuid4())
class BaseUser(Table, db=DB):
uuid = UUID(primary_key=True, default=generate_uuid)
username = Varchar()
class Post(Table, db=DB):
uuid = UUID(primary_key=True, default=generate_uuid)
post_user = ForeignKey(BaseUser, null=False)
description = Text()
users_mentioned = Array(base_column=UUID(default=generate_uuid))
if __name__ == "__main__":
results = Post.objects().run_sync()
print(results)
related_results = Post.select(Post.all_columns()).run_sync()
print(related_results) Execution is instant. I hope that makes sense and you can use it in your case. |
hello all,
Assume we have a simple
Post
table:When I perform a
Post.objects().run_sync()
orPost.select(Post.all_columns()).run_sync()
the query is extremely slow.But when I leave out querying
users_mentioned: Array(UUID())
such asPost.select(Post.uuid).run_sync()
the query speeds are as expected (empty table).From looking at my cluster, it performs a very complex query (10s+) each time I request for the
Array(UUID())
datatype:Performing a query without piccolo such as:
works fine/speed as intended.
please send help if I am doing anything wrong
The text was updated successfully, but these errors were encountered: