Any way to get query data dynamically while its executing.

sahil_kumarsahil_kumar Vertica Employee Employee
edited May 2020 in General Discussion

A client asked , if it is possible to get query data dynamically while it is executing, in batches for example.
instead of waiting until all the data is fetched and formated, client wants to get each time part of the data that has already been parsed.
for example select * from table limit 10000; (instead of waiting to all the 10000 rows get 1000 each time)
if it exists does it works with the order by clause?

Tagged:

Best Answers

  • sahil_kumarsahil_kumar Vertica Employee Employee
    Answer ✓

    thanks @Abhishek_Rana for detailed explanation.

Answers

  • qinchaofengqinchaofeng Vertica Customer

    Do you want the paging function?
    You can refer to OFFSETClause

  • sahil_kumarsahil_kumar Vertica Employee Employee

    @qinchaofeng yes the client referred paging function.

  • sahil_kumarsahil_kumar Vertica Employee Employee

    Not really sure if offsetclause will help to get query data dynamically.

  • sahil_kumarsahil_kumar Vertica Employee Employee

    thanks @marcothesane that actually makes sense.

  • moshegmosheg Vertica Employee Administrator

    In addition maybe parallel insert select can provide a way to analyze portions of the result set.
    Example 1:

        INSERT INTO MY_TABLE  
               SELECT a,b,c
               FROM OTHER_TABLE
               WHERE hash(a)/((9223372036854775807/YOUR_NODE_COUNT) + 1)= YOUR_SEGMENT;
    

    Example 2:

        INSERT INTO foo_cp
        SELECT * from foo
        WHERE HASH( some_column ) % 4 = 0;
    
        INSERT INTO foo_cp
        SELECT * from foo
        WHERE HASH( some_column ) % 4 = 1;
    
        INSERT INTO foo_cp
        SELECT * from foo
        WHERE HASH( some_column ) % 4 = 2;
    
        INSERT INTO foo_cp
        SELECT * from foo
        WHERE HASH( some_column ) % 4 = 3;
    

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file