Thread: SQL State 42P01

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2014
    Posts
    49
    Rep Power
    4

    SQL State 42P01


    Hi all,

    I have this query I am executing against a postgres database instance 9.3,
    Code:
    
    SELECT relname
    	, seq_scan-idx_scan AS too_much_seq
    	, case when seq_scan-idx_scan>0 THEN 'Missing Index?' ELSE 'OK' END
    	, pg_relation_size(relname::regclass) AS rel_size
    	, seq_scan, idx_scan
     FROM pg_stat_all_tables
     WHERE schemaname='atg' AND pg_relation_size(relname::regclass)>80000 
    		/*AND relname NOT IN ('iml_returns'
    					,'purch_order'
    					, 'rpt_dates'
    					,'paypal_analysis_validation'
    					, 'ntv_data_mv_cte'
    					,'sg_atg_test','sg_atg_set','personalized_skul', 'month_sku_rollup', 'on_order_sku_rollup', 'back_order_sku')*/
     ORDER BY too_much_seq DESC;
    This checks to see if there are more sequence scans than index scan.

    When I execute the query it complains of the existing relations not being in existence with a SQL state:42P01.

    Is there a way I can resolve this.

    Thanks,

    Ron
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Frequenter (2500 - 2999 posts)

    Join Date
    Oct 2003
    Location
    Germany
    Posts
    2,803
    Rep Power
    352
    Please post the complete and exact error message.
    I will not read nor answer questions where the SQL code is messy and not formatted properly using [code] tags.
    http://forums.devshed.com/misc.php?do=bbcode#code

    Tips on how to ask better questions:
    http://tkyte.blogspot.de/2005/06/how-to-ask-questions.html
    http://wiki.postgresql.org/wiki/SlowQueryQuestions
    http://catb.org/esr/faqs/smart-questions.html

IMN logo majestic logo threadwatch logo seochat tools logo