sasha-alias / sqltabs

Rich SQL client for Postgresql, MySQL, MS SQL, Amazon Redshift, Google Firebase (Firestore)
https://www.sqltabs.com
GNU General Public License v3.0
803 stars 57 forks source link

Seems like SQL Tabs may be causing performance issue in Database (RDS/postgres) #128

Open NachiMK opened 5 years ago

NachiMK commented 5 years ago

Hi,

Been recently in fond of using SQL Tabs. I use it to connect to RDS database on AWS. I connect to postgres flavor of the database. My database is behind a VPN and I am on same VPN and I connect from same region as my instance is at.

I noticed that SQL Tabs runs the below query:

/*sqltabs*/ 
SELECT hashtext(string_agg(word, '')) 
FROM (     
        SELECT DISTINCT word 
        FROM 
            (
                    SELECT nspname AS word FROM pg_namespace
            UNION   SELECT relname FROM pg_class
            UNION   SELECT proname FROM pg_proc
            UNION   SELECT attname FROM pg_attribute
            UNION   SELECT name FROM pg_settings
            ) v 
        ORDER BY 1 
    ) w 
ORDER BY 1

It runs it repeatedly and also seems to leave the sessions active (meaning nothing is closed). So my CPU usage went high and number of active sessions hit 400+ within 8 hours.

I do have 6 databases and some databases are reporting database with data from multiple sources so I have close to 1000+ tables. But, none of the databases are yet used by end users because it is still in testing and with me there is only one other person works on it. The database is loaded with data every half hour so my process is not the one causing issues.

Is there any where I can disable inteli-sense completely and try this out? I am planning to test my theory one more time and If I find anything I will let you know.

Thanks, Nachi MK

sasha-alias commented 5 years ago

hi, you can try to comment out these 2 lines https://github.com/sasha-alias/sqltabs/blob/master/src/Dispatcher.js#L390-L391 and make an own build to see if it helps.

For the future we probably have to disable getting keywords from DB in case autocompletion is off. Other ideas are also appreciated.