In a nutshell you need to write efficent queries that process fewer records more specifically when you run queries to fetch data inside a trigger you should not be traversing more than 100,000 records in a object. The key thing to note here is that it apply on number of records on a table even if only a single record is returned due to all where clauses in your query.
A selective query is one that uses indices to restrict the initial table scans to less than 100,000 rows (as Amit mentioned). A non-selective query is one that does not use indices to restrict the initial table scan and therefore requires a full table scan. Salesforce limits slow queries in order to maximize performance for all users. In general, normal users can't run queries that would be non-selective, so that there are enough resources to go around.
// Non-Selective, if there are too many rows in database
Account[] a = [select id,name,numberofemployees from account where numberofemployees in (10,100,1000,10000)];
// Selective, because account name is indexed
Account[] a = [select id,name,numberofemployees from account where name > 'k' and name < 'p'];
Please note that a non-selective query won't fail unless there are a large number of records in the database, so it can be non-trivial to determine if a query is non-selective. A general rule of thumb is this: If a SOSL search would return a value using only a FIND clause (no WHERE clauses), the field is probably indexed, while if a SOQL query or WHERE clause is required, it is probably non-indexed. You can also review the Help & Training and developer docs to determine if a field is indexed.
Here is a very good article is salesforce documentation about this.
http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_SOQL_VLSQ.htm
In a nutshell you need to write efficent queries that process fewer records more specifically when you run queries to fetch data inside a trigger you should not be traversing more than 100,000 records in a object. The key thing to note here is that it apply on number of records on a table even if only a single record is returned due to all where clauses in your query.
Can you give examples for Selective and non-selective Queries.
Regards.
Please note that a non-selective query won't fail unless there are a large number of records in the database, so it can be non-trivial to determine if a query is non-selective. A general rule of thumb is this: If a SOSL search would return a value using only a FIND clause (no WHERE clauses), the field is probably indexed, while if a SOQL query or WHERE clause is required, it is probably non-indexed. You can also review the Help & Training and developer docs to determine if a field is indexed.