turbot / steampipe

Zero-ETL, infinite possibilities. Live query APIs, code & more with SQL. No DB required.
https://steampipe.io
GNU Affero General Public License v3.0
6.86k stars 267 forks source link

Add verbose timing mode #4244

Closed kaidaguerre closed 5 months ago

kaidaguerre commented 5 months ago

add support for verbose timing information:

steampipe query "select
>   i.instance_id,
>   i.vpc_id,
>   i.subnet_id,
>   s.tags ->> 'Name' as subnet_name
> from
>   aws_ec2_instance as i,
>   aws_vpc_subnet as s
> where
>   i.subnet_id = s.subnet_id;" --timing=verbose

+---------------------+-----------------------+--------------------------+-------------+
| instance_id         | vpc_id                | subnet_id                | subnet_name |
+---------------------+-----------------------+--------------------------+-------------+
| i-003674d0ac04d53ec | vpc-9d7ae1e7          | subnet-301e4b1e          | <null>      |
| i-008718b1905f68bea | vpc-9d7ae1e7          | subnet-301e4b1e          | <null>      |
| i-00655ef12ceede81e | vpc-9d7ae1e7          | subnet-301e4b1e          | <null>      |
| i-02644923b35ca9930 | vpc-9d7ae1e7          | subnet-22534d68          | <null>      |
| i-0c47047098a7e905b | vpc-9d7ae1e7          | subnet-22534d68          | <null>      |
| i-04bf973fd32b45f64 | vpc-9d7ae1e7          | subnet-22534d68          | <null>      |
| i-0a79c2f53cb998adc | vpc-9d7ae1e7          | subnet-22534d68          | <null>      |
| i-09cb4a9ecdfb87edb | vpc-9d7ae1e7          | subnet-22534d68          | <null>      |
| i-0498a0e2795d68fde | vpc-9d7ae1e7          | subnet-22534d68          | <null>      |
| i-0074cfe7eeaf1e459 | vpc-0de60777fdfd2ebc7 | subnet-017963228ed05c73d | <null>      |
| i-05771a0dba190321d | vpc-0de60777fdfd2ebc7 | subnet-017963228ed05c73d | <null>      |
| i-0c8227e9ac5fc9597 | vpc-0de60777fdfd2ebc7 | subnet-017963228ed05c73d | <null>      |
| i-0fbfe0ee6ca025ca4 | vpc-0de60777fdfd2ebc7 | subnet-017963228ed05c73d | <null>      |
| i-0d864d8296be8d90a | vpc-0de60777fdfd2ebc7 | subnet-017963228ed05c73d | <null>      |
| i-0debdf6152e8e8531 | vpc-0bbbcfd98363f5266 | subnet-0a2c499fc37a6c1fe | <null>      |
| i-0e7b99b1c56af4bff | vpc-07d9e360          | subnet-bccecfe7          | <null>      |
+---------------------+-----------------------+--------------------------+-------------+

Time: 11.6s. Rows returned: 16. Rows fetched: 36. Hydrate calls: 0.

Scans:
  1) Table: aws_ec2_instance. Connection: _morales. Time: 1.5s. Rows fetched: 3. Hydrate calls: 0. Quals: [{"column":"subnet_id","operator":"=","value":"subnet-301e4b1e"}].
  2) Table: aws_ec2_instance. Connection: _morales. Time: 492ms. Rows fetched: 6. Hydrate calls: 0. Quals: [{"column":"subnet_id","operator":"=","value":"subnet-22534d68"}].
  3) Table: aws_ec2_instance. Connection: _morales. Time: 441ms. Rows fetched: 5. Hydrate calls: 0. Quals: [{"column":"subnet_id","operator":"=","value":"subnet-017963228ed05c73d"}].
  4) Table: aws_ec2_instance. Connection: _morales. Time: 439ms. Rows fetched: 1. Hydrate calls: 0. Quals: [{"column":"subnet_id","operator":"=","value":"subnet-0a2c499fc37a6c1fe"}].
  5) Table: aws_ec2_instance. Connection: _morales. Time: 439ms. Rows fetched: 1. Hydrate calls: 0. Quals: [{"column":"subnet_id","operator":"=","value":"subnet-bccecfe7"}].
  6) Table: aws_vpc_subnet. Connection: _morales. Time: 11.5s. Rows fetched: 20. Hydrate calls: 0.

Also, the JSON output should alway includes the full timing information (even more than the verbose mode), under the metadata property