Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Cloud SQL: Unable to execute statement

My Google cloud sql table have 1126571 rows currently and adding minimum 30 thousand every day.When execute the query :

select count(distinct sno) as tot from visits

sql prompt it will generate following error:

Error 0: Unable to execute statement 

. Is Cloud SQL Query liable to 60 seconds exceed exception. How can overcome the problem when the table become large.

like image 256
Master Mind Avatar asked Oct 19 '12 09:10

Master Mind


1 Answers

Break the table into two tables. One to receive new visits ... transactions ... one for reporting. Index the reporting table. Transfer and clear data on a regular basis.

The transaction table will remain relatively small and thus it will be fast to count. The reporting table will be fast to count because of the index.

like image 59
Keith John Hutchison Avatar answered Oct 05 '22 03:10

Keith John Hutchison