Skip to content
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

Loss of interactivity when streaming a large non-materialized result set #7576

Closed
philip-stoev opened this issue Jul 28, 2021 · 1 comment · Fixed by #7171
Closed

Loss of interactivity when streaming a large non-materialized result set #7576

philip-stoev opened this issue Jul 28, 2021 · 1 comment · Fixed by #7171
Labels
C-bug Category: something is broken
Projects

Comments

@philip-stoev
Copy link
Contributor

What version of Materialize are you using?

v0.8.4-dev (f98fbfdc9)

What was the issue?

This is the original example @benesch gave in #1537. I am creating a separate ticket in order to add context and perf reports and also to underline that the problem this particular case exposed appears to be specifically about streaming large non-materialized results as opposed to e.g. join processing.

Is the issue reproducible? If so, please provide reproduction instructions.

drop view if exists v cascade; 
create materialized view v as values (1), (2), (3);
select * from v, v, v, v, v, v, v, v, v, v, v, v, v, v;

Interactivity is not lost if the select is wrapped inside a materialized view and then the same data is read off that view. The mz_scheduling_histogram of the materialized view does not have any extremes in the duration column.

The perf report looks like this:

-   18.35%    18.33%  tokio:work-12    materialized        [.] <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend                                                               ◆
     16.46% <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend                                                                                                                  ▒
-    5.13%     5.13%  tokio:work-12    materialized        [.] repr::row::read_datum                                                                                                                         ▒
   - 1.32% 0x400000003040000                                                                                                                                                                                 ▒
      - 1.19% 0x46                                                                                                                                                                                           ▒
           repr::row::read_datum                                                                                                                                                                             ▒
   - 1.28% 0x400000002040000                                                                                                                                                                                 ▒
      - 1.17% 0x46                                                                                                                                                                                           ▒
           repr::row::read_datum                                                                                                                                                                             ▒
   - 1.26% 0x400000001040000                                                                                                                                                                                 ▒
      - 1.16% 0x46                                                                                                                                                                                           ▒
           repr::row::read_datum                                                                                                                                                                             ▒
     1.07% repr::row::read_datum                                                                                                                                                                             ▒
-    4.88%     0.00%  tokio:work-12    [unknown]           [.] 0x00007f2ae89ef890                                                                                                                            ▒
   - 0x7f2ae89ef890                                                                                                                                                                                          ▒
        1.25% <bytes::bytes_mut::BytesMut as ore::fmt::FormatBuffer>::write_fmt                                                                                                                              ▒
        0.83% std::io::Write::write_fmt                                                                                                                                                                      ▒
        0.57% pgrepr::value::Value::encode_text                                                                                                                                                              ▒
        0.54% <pgwire::codec::Codec as tokio_util::codec::encoder::Encoder<pgwire::message::BackendMessage>>::encode                                                                                         ▒
        0.51% <bytes::bytes_mut::BytesMut as bytes::buf::buf_mut::BufMut>::put_slice                                                                                                                         ▒
-    4.59%     0.00%  tokio:work-12    [unknown]           [.] 0x0000000000000046                                                                                                                            ▒
   - 0x46                                                                                                                                                                                                    ▒
        3.52% repr::row::read_datum                                                                                                                                                                          ▒
        0.56% repr::row::Row::unpack                                                                                                                                                                         ▒
-    4.59%     0.00%  timely:work-1    [unknown]           [.] 0x0000000000000135                                                                                                                            ▒
   - 0x135                                                                                                                                                                                                   ▒
        4.14% repr::row::Row::try_pack                                                                                                                                                                       ▒
-    4.35%     0.00%  timely:work-1    [unknown]           [.] 0x1056394808568b48                                                                                                                            ▒
   - 0x1056394808568b48                                                                                                                                                                                      ▒
        2.53% <repr::row::DatumListIter as core::iter::traits::iterator::Iterator>::next                                                                                                                     ▒
        0.92% dataflow::render::join::linear_join::<impl dataflow::render::context::Context<G,repr::row::Row,T>>::differential_join_inner::{{closure}}                                                       ▒
+    4.14%     4.13%  timely:work-1    materialized        [.] repr::row::Row::try_pack                                                                                                                      ▒
+    3.62%     3.61%  tokio:work-12    materialized        [.] <alloc::vec::Vec<T> as alloc::vec::spec_from_iter::SpecFromIter<T,I>>::from_iter                                                              ▒
+    3.00%     3.00%  timely:work-1    materialized        [.] <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend                                                               ▒
+    2.75%     2.75%  timely:work-1    materialized        [.] <repr::row::DatumListIter as core::iter::traits::iterator::Iterator>::next                                                                    ▒
+    2.74%     1.54%  timely:work-1    materialized        [.] smallvec::SmallVec<A>::insert_from_slice                                                                                                      ▒
+    2.30%     0.28%  timely:work-1    [kernel.kallsyms]   [k] page_fault                                                                                                                                    ▒
+    2.20%     2.20%  timely:work-1    materialized        [.] dataflow::render::join::linear_join::<impl dataflow::render::context::Context<G,repr::row::Row,T>>::differential_join_inner::{{closure}}      ▒
+    2.19%     2.19%  timely:work-1    libc-2.31.so        [.] __memcmp_avx2_movbe                                                                                                                           ▒
+    2.15%     0.00%  tokio:work-12    [unknown]           [.] 0x0400000003040000                                                                                                                            ▒
+    2.09%     0.00%  tokio:work-12    [unknown]           [.] 0x0400000002040000                                                                                                                            ▒
+    2.03%     0.00%  tokio:work-12    [unknown]           [.] 0x0400000001040000                                                                                                                            ▒
+    2.02%     0.00%  timely:work-1    [unknown]           [k] 0x0000000000000010                                                                                                                            ▒
+    2.02%     0.00%  timely:work-1    [kernel.kallsyms]   [k] do_page_fault                                                                                                                                 ▒
+    2.02%     0.01%  timely:work-1    [kernel.kallsyms]   [k] __do_page_fault                                                                                                       ```
@philip-stoev philip-stoev added the C-bug Category: something is broken label Jul 28, 2021
@philip-stoev philip-stoev linked a pull request Aug 4, 2021 that will close this issue
@philip-stoev
Copy link
Contributor Author

This appears fixed by #7171 . Other SQL clients can successfully issue queries while the cross join above is in progress.

@uce uce added this to Needs Triage in Compute Aug 5, 2021
Compute automation moved this from Needs Triage to Done Aug 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: something is broken
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

1 participant