Fix formatting on pg_array_column_postgrest

Signed-off-by: Pierre-Yves Chibon <pingou@pingoured.fr>
This commit is contained in:
Pierre-Yves Chibon 2021-02-17 09:59:08 +01:00
parent 4f0a08ac18
commit 5c96c94175

View file

@ -1,5 +1,5 @@
Using the array type for user and package queries Using the array type for user and package queries
=============================== =================================================
Currently, we use auxiliary tables to query for messages related to packages or users, Currently, we use auxiliary tables to query for messages related to packages or users,
in the standard RDBS fashion. in the standard RDBS fashion.
@ -29,7 +29,7 @@ To add new column
To populate it To populate it
:: ::
update messages2 set packages=t_agg.p_agg from update messages2 set packages=t_agg.p_agg from
(select msg, array_agg(package) as p_agg from package_messages group by msg) as t_agg where messages.id=t_agg.msg; (select msg, array_agg(package) as p_agg from package_messages group by msg) as t_agg where messages.id=t_agg.msg;
We need to enable the btree_gin extension to be able to create index with array as well as timestamp We need to enable the btree_gin extension to be able to create index with array as well as timestamp
@ -58,13 +58,13 @@ A simple membership:
A simple membership ordered by time. A simple membership ordered by time.
:: ::
/messages_ts?order=timestamp.desc&packages=ov.{{kernel}} /messages_ts?order=timestamp.desc&packages=ov.{{kernel}}
Findings Findings
-------- --------
Querying just the package membership Querying just the package membership
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The queries were surprisingly fast, with maximum under 4 seconds and The queries were surprisingly fast, with maximum under 4 seconds and
mean around half a second. This encouraged us to do further experiments. mean around half a second. This encouraged us to do further experiments.
@ -78,7 +78,7 @@ Results ::
Time per Request - mean: 0.522946, min: 0.000000, max: 3.907548 Time per Request - mean: 0.522946, min: 0.000000, max: 3.907548
Querying just the package membership ordered by timestamp desc Querying just the package membership ordered by timestamp desc
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Usually we want to see most recent messages. So we ammended the query, Usually we want to see most recent messages. So we ammended the query,
to include "order by timestamp desc". The result was less encouraging, to include "order by timestamp desc". The result was less encouraging,
@ -95,7 +95,7 @@ Results ::
Time per Request - mean: 7.474040, min: 0.000000, max: 99.880939 Time per Request - mean: 7.474040, min: 0.000000, max: 99.880939
Conclusion Conclusion
-------------- ----------
While array support seems interesting, and for simple queries very fast, indexes that require ordering While array support seems interesting, and for simple queries very fast, indexes that require ordering
don't seem to be supported. This makes strong case against using them. don't seem to be supported. This makes strong case against using them.