Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Query Selectivity Computation Expand / Collapse
Author
Message
Posted Thursday, May 6, 2010 3:49 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, May 17, 2010 6:02 AM
Points: 7, Visits: 23
Hi friends,

I m executing different queries with different parameter values from my application.
How to compute selectivity of a query with particular parameter?
Post #916757
Posted Thursday, May 6, 2010 3:58 AM
SSC Rookie

SSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC RookieSSC Rookie

Group: General Forum Members
Last Login: Friday, December 21, 2012 1:44 AM
Points: 25, Visits: 289
gaurangtalwadkar (5/6/2010)
Hi friends,

I m executing different queries with different parameter values from my application.
How to compute selectivity of a query with particular parameter?


distinct_values_count / all_values_count


---------------------------------------
Thorn Bird...
Post #916765
Posted Thursday, May 6, 2010 4:28 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, May 17, 2010 6:02 AM
Points: 7, Visits: 23
I want to know whether der is any in-built function in SQL Server which gives selectivity of the query when the query is executed.
Post #916785
Posted Thursday, May 6, 2010 6:07 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Yesterday @ 12:27 PM
Points: 15,541, Visits: 27,919
A query is not selective or not. The data it is accessing may or may not be selective. I don't understand where you're trying to go with this.

You can query statistics and indexes to determine the selectivity of the underlying data. Is that what you're looking for?


----------------------------------------------------
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of: SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #916844
Posted Thursday, May 13, 2010 7:37 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Monday, May 17, 2010 6:02 AM
Points: 7, Visits: 23
Hi everybody,

how can I get query selectivity estimation in Sql server?

I m executing query from C# application where I have provide text editor to write sql queries.
Post #921255
Posted Monday, May 17, 2010 5:48 AM


SSCoach

SSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoachSSCoach

Group: General Forum Members
Last Login: Yesterday @ 12:27 PM
Points: 15,541, Visits: 27,919
I still don't understand what you're asking for? A query has no selectivity. There is not a measured set of uniquely identifying data about a query. The data stored in tables and indexes have selectivity. You're going to have to better define what it is that you're looking for in order to get a specific answer.

----------------------------------------------------
"The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood..." Theodore Roosevelt
The Scary DBA
Author of: SQL Server 2012 Query Performance Tuning
SQL Server 2008 Query Performance Tuning Distilled
and
SQL Server Execution Plans

Product Evangelist for Red Gate Software
Post #922830
Posted Monday, May 17, 2010 5:56 AM


SSChampion

SSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampionSSChampion

Group: General Forum Members
Last Login: Yesterday @ 2:22 PM
Points: 12,889, Visits: 31,839
he had a similar thread on this;
i think the original poster is trying to get a formula like (#records matching my WHERE clause) / Total Records, but he thinks it is stored in the statistics of the server?

That's not the same as the statistics kept in SQL Server, and would vary for every query with a different WHERE statmenet.


Lowell

--There is no spoon, and there's no default ORDER BY in sql server either.
Actually, Common Sense is so rare, it should be considered a Superpower. --my son
Post #922838
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse