Perfetto sql related question
I can not use some sql commnad like "insert into" on perfetto sql query interface.
Could you please provide me some information about supported sql instruction?
You can't use insert into on Perfetto tables, only on standard tables which are no longer preferred, as their performance is worse than performance of perfetto tables.
Create table is still enabled, so as long as you don't want to submit your code to Perfetto codebase, using it should be fine.
Feel free to let me know if you have any other questions.
Anna
On Mon, Aug 21, 2023, 8:19 AM c-jchen @.***> wrote:
I can not use some sql commnad like "insert into" on perfetto sql query interface.
Could you please provide me some information about supported sql instruction?
— Reply to this email directly, view it on GitHub https://github.com/google/perfetto/issues/564, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZ3CHTTO6L53T2GOBIP42TLXWMDYRANCNFSM6AAAAAA3X55OFQ . You are receiving this because you are subscribed to this thread.Message ID: @.***>
Many thanks for your kind work.
I also can not use "IF or drop" command
Do you have opinions for this?
----------------- Imp --------------------- IF OBJECT_ID('table_cj1') IS NOT NULL DROP TABLE table_cj1
XXXXXXXXXXX XXX
----------------- Error msg ------------- SQL error: Traceback (most recent call last): File "stdin" line 1 col 14 create table table_cj1 AS ^ table table_cj1 already exists
Can you send me an example of code that doesn't work? Create perfetto table should work with dropping and you don't need to use Perfetto when doing this.
So "DROP IF EXISTS FOO; CREATE PERFETTO TABLE FOO" should work.
On Mon, Aug 21, 2023, 8:47 AM c-jchen @.***> wrote:
Many thanks for your kind work.
I also can not use "IF or drop" command
Do you have opinions for this?
----------------- Error msg ------------- SQL error: Traceback (most recent call last): File "stdin" line 1 col 14 create table table_cj1 AS ^ table table_cj1 already exists
— Reply to this email directly, view it on GitHub https://github.com/google/perfetto/issues/564#issuecomment-1685822411, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZ3CHTWAKCZ24FCAOEMBZ5TXWMG77ANCNFSM6AAAAAA3X55OFQ . You are receiving this because you commented.Message ID: @.***>
I use perfetto to open android trace file.
Below are my source and produced error msg
-------------------- source --------------------------- DROP IF EXISTS table_cj1 DROP IF EXISTS table_cj2
create table table_cj1 AS select ts, value FROM counter where track_id=226;
create table table_cj2 AS select ts, value FROM counter where track_id=133;
select ts, value+vaule_1 from table_cj1 t1 join table_cj2 t2 on t1.ts = t2.ts
-------------------------error ------------------------------ SQL error: Traceback (most recent call last): File "stdin" line 1 col 6 DROP IF EXISTS table_cj1 ^ near "IF": syntax error
You need to add semicolon at the end of drop statement :)
On Mon, Aug 21, 2023, 8:55 AM c-jchen @.***> wrote:
I use perfetto to open android trace file.
Below are my source and produced error msg
-------------------- source --------------------------- DROP IF EXISTS table_cj1 DROP IF EXISTS table_cj2
create table table_cj1 AS select ts, value FROM counter where track_id=226;
create table table_cj2 AS select ts, value FROM counter where track_id=133;
select ts, value+vaule_1 from table_cj1 t1 join table_cj2 t2 on t1.ts = t2.ts
-------------------------error ------------------------------ SQL error: Traceback (most recent call last): File "stdin" line 1 col 6 DROP IF EXISTS table_cj1 ^ near "IF": syntax error
— Reply to this email directly, view it on GitHub https://github.com/google/perfetto/issues/564#issuecomment-1685833330, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZ3CHTQRZGO35CZSTONPEKTXWMH6JANCNFSM6AAAAAA3X55OFQ . You are receiving this because you commented.Message ID: @.***>
I tried add semicolon too..
It is not work... XD
I enter commands by perfetto query UI..
----------------------- source ------------------------- DROP IF EXISTS table_cj1; DROP IF EXISTS table_cj2;
create table table_cj1 AS select ts, value FROM counter where track_id=226;
create table table_cj2 AS select ts, value FROM counter where track_id=133;
select ts, value+vaule_1 from table_cj1 t1 join table_cj2 t2 on t1.ts = t2.ts
On Mon, Aug 21, 2023, 9:02 AM c-jchen @.***> wrote:
I tried add semicolon too..
It is not work... XD
----------------------- source ------------------------- DROP IF EXISTS table_cj1**;**
DROP TABLE IF EXISTS table_cj1:
DROP IF EXISTS table_cj2**;**
DROP TABLE IF EXISTS table_cj2:
create table table_cj1 AS select ts, value FROM counter where track_id=226;
create table table_cj2 AS select ts, value FROM counter where track_id=133;
select ts, value+vaule_1 from table_cj1 t1 join table_cj2 t2 on t1.ts = t2.ts
— Reply to this email directly, view it on GitHub https://github.com/google/perfetto/issues/564#issuecomment-1685844052, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZ3CHTWNQQTSXYET6ILIFBTXWMI2RANCNFSM6AAAAAA3X55OFQ . You are receiving this because you commented.Message ID: @.***>
Many Thanks
It is work.
However, I only know SQLite used by perfetto.
I try to read perfetto doc, but it seemd not mention about some instruction of SQL can not be use.
Does perfetto have some suggestion user guide for this SQL command?
We are in the middle of writing documentation for Perfetto SQL, so it's not available yet. Fortunately changes are quite straightforward - use Perfetto table as you would use standard table, just add a Perfetto keyword to create table. Perfetto tables are immutable, so you can't insert anything inside later.
On Mon, Aug 21, 2023, 9:19 AM c-jchen @.***> wrote:
Many Thanks
It is work.
However, I only know SQLite used by perfetto.
I try to read perfetto doc, but it seemd not mention about some instruction of SQL can not be use.
Does perfetto have some suggestion user guide for this SQL command?
— Reply to this email directly, view it on GitHub https://github.com/google/perfetto/issues/564#issuecomment-1685870892, or unsubscribe https://github.com/notifications/unsubscribe-auth/AZ3CHTW6KVIHV7QDT6U5PODXWMKXXANCNFSM6AAAAAA3X55OFQ . You are receiving this because you commented.Message ID: @.***>
Looking forward to read documentation for Perfetto SQL