Open Jacky56 opened 3 weeks ago
Another interesting note:
Array(UUID())
to Array(Varchar())
would still run the complex queryArray(?)
to JSONB
would still run the complex query@Jacky56 You are doing everything right on the table definition and querying Piccolo. I think the problem is how asynpg
works with CockroachDB
. There have been several issues online based on this. I have Cockroach v22
on my local machine and I can't even insert data with arrays because the error is unable to decorate subquery
(which was resolved in v23
). Then I upgrade to the latest version available (v24.1.0
) and I get the same as you, a very slow query with a complex query in the cluster log. I don't think we can do anything in Piccolo, Based on this discussion the type introspection is done once and I can confirm that if we use a connection pool only the first query is slow and every other query is fine. psycopg
doesn't have those problems but Piccolo is based on asyncpg
@sinisaos Thanks for looking into this. Hopefully asyncpg
will solve this problem in a future version. It's a good reason for us to consider supporting multiple Postgres client libraries. I'm going to try upgrading our CI to use Cockroach v24
.
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