MySQL prints each query in General query logs. This can be helpful in application profiling if you want to see how many and which queries are being run in a transaction and when commit/rollback is executed. You can enable MySQL general query logs by running below sql command from root user: By default, logs will be stored at /var/log/query.log … Continue reading MySQL General query logs
Author: Shashank vivek
Increase MySQL maximum connection limit
MySQL’s default configuration sets the maximum concurrent connections to 151. If you get a too many connections error when you are trying to connect to MySQL server, this means that all available connections are in use by other clients / Users. The number of connections permitted is controlled by the max_connections system variable. Its default value … Continue reading Increase MySQL maximum connection limit
kill a running query in postgres
There are queries which takes more times to execute. Sometimes you need to stop the queries but you can't do it simply(Ctrl+c) because queries are coming from application. There are mainly two approaches to kill the query. You can find the process corresponding to the query & kill or you can find the procpid of … Continue reading kill a running query in postgres
Django – AttributeError: ‘Http404’ object has no attribute ‘status_code’
If you getting this error, it might be because you are returning Http404 instead of raising it. you need to raise django.http.Http404, not return it. example code :
MySQL query with the conditions as ‘NOT LIKE IN’
While working with MySQL database i needed to write a query which will exclude rows where a column contains one or more words from a set of words. i.e I want to fetch data from student from table where name doesn't contain words shashank,john etc. Initially i was trying to write a query like this : … Continue reading MySQL query with the conditions as ‘NOT LIKE IN’
Interview Question of the Week #003 – How to Write Script for Database Cursor?
switching back to text console error during centos installation
I was trying to dual-boot CentOS 6 on my laptop that is currently running Windows 8. I have two storage devices, an SSD that has my Windows installation, and an HDD that has all of my data. Both are formatted using GPT, and Windows boots using UEFI. I used the CentOS 6.5 live CD (CentOS-6.5-x86_64-LiveCD.iso) … Continue reading switching back to text console error during centos installation
PHP cURL
cURL Requests with PHP CURL is a way you can hit a URL from your code to get a HTML response from it. cURL means client URL which allows you to connect with other URLS and use there responses in your code. Introduction cURL allows transfer of data across a wide variety of protocols, and … Continue reading PHP cURL
Disable an index in postgres
If you have got one index on a table that you would like to temporarily disable you can do following steps. You can poke the system catalogue to disable an index: This means that the index won't be used for queries but will still be updated. It's one of the flags used for concurrent index … Continue reading Disable an index in postgres
‘ascii’ codec can’t encode characters : ordinal not in range(128)
I work on a system which fetches data from a database (Postgres) using python & writes them into a csv file. Few days ago i came through an error which was showing "ascii codec can't encode characters : ordinal not in range(128)" whenever i tried to fetch data from a particular date range. Problem : … Continue reading ‘ascii’ codec can’t encode characters : ordinal not in range(128)