Skip to content

select sum(i) from range(1,10000001)t(i); return no result #17

@l1t1

Description

@l1t1

I run it in psql

root@6ae32a5ffcde:/# psql 'postgresql://localhost:15432/main'
psql (15.13 (Debian 15.13-0+deb12u1), server 14)
Type "help" for help.

main=> select version();
 "version"()
-------------
 v1.4.0
(1 row)
main=> \timing on
Timing is on.
main=> select sum(i) from range(1,10000001)t(i); ---------------this line---------------
--
(1 row)

Time: 72.905 ms
main=> select count(i) from range(1,10000001)t(i);
 count(i)
----------
 10000000
(1 row)

Time: 3.482 ms
main=> select sum(i::bigint) from range(1,10000001)t(i); ---------------and this line---------------
--
(1 row)

Time: 22.043 ms

main=> explain analyze select sum(i) from range(1,10000001)t(i);
  explain_key  |                       explain_value
---------------+-----------------------------------------------------------
 analyzed_plan | ┌─────────────────────────────────────┐                  +
               | │┌───────────────────────────────────┐│                  +
               | ││    Query Profiling Information    ││                  +
               | │└───────────────────────────────────┘│                  +
               | └─────────────────────────────────────┘                  +
               | explain analyze select sum(i) from range(1,10000001)t(i);+
               | ┌────────────────────────────────────────────────┐       +
               | │┌──────────────────────────────────────────────┐│       +
               | ││              Total Time: 0.0163s             ││       +
               | │└──────────────────────────────────────────────┘│       +
               | └────────────────────────────────────────────────┘       +
               | ┌───────────────────────────┐                            +
               | │           QUERY           │                            +
               | └─────────────┬─────────────┘                            +
               | ┌─────────────┴─────────────┐                            +
               | │      EXPLAIN_ANALYZE      │                            +
               | │    ────────────────────   │                            +
               | │           0 rows          │                            +
               | │          (0.00s)          │                            +
               | └─────────────┬─────────────┘                            +
               | ┌─────────────┴─────────────┐                            +
               | │    UNGROUPED_AGGREGATE    │                            +
               | │    ────────────────────   │                            +
               | │    Aggregates: sum(#0)    │                            +
               | │                           │                            +
               | │           1 row           │                            +
               | │          (0.01s)          │                            +
               | └─────────────┬─────────────┘                            +
               | ┌─────────────┴─────────────┐                            +
               | │         PROJECTION        │                            +
               | │    ────────────────────   │                            +
               | │             i             │                            +
               | │                           │                            +
               | │      10,000,000 rows      │                            +
               | │          (0.00s)          │                            +
               | └─────────────┬─────────────┘                            +
               | ┌─────────────┴─────────────┐                            +
               | │         TABLE_SCAN        │                            +
               | │    ────────────────────   │                            +
               | │      Function: RANGE      │                            +
               | │                           │                            +
               | │      10,000,000 rows      │                            +
               | │          (0.00s)          │                            +
               | └───────────────────────────┘                            +
               |
(1 row)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions