Questions tagged [clustered-index]

A clustered index determines the physical order of data in a table.

Filter by
Sorted by
Tagged with
0 votes
2 answers
31 views

Best method for updating SQL Server partition function

I have several large SQL Server tables where the current partition functions are not extended beyond this month, and the procedure that is supposed to split the partition function into new date ranges ...
user8675309's user avatar
-1 votes
0 answers
50 views

Will be slow if I query with the 2nd part of a composite clustered primary key in a partitioned table?

I have a big partitioned table (close to a billion rows), which has a clustered primary key on the partition column and an identity id key (dateSubmitted Date, id long) and want to query it using only ...
DimitrisK's user avatar
0 votes
0 answers
145 views

DELETE Command taking a lot of time with clustered index

I don't have large amount of data in my table. it contains only 16000 records. I want to delete around 33 records from this table which is taking 9-10 seconds. Below is the schema of the table and ...
Ronak's user avatar
  • 127
1 vote
1 answer
29 views

impact of writing data out of order relative to clustered index

I have a database table with a clustered index, basically on a timestamp. If I insert a large amount of data out of order relative to that clustered index (ie. I write data with a timestamp from any ...
steve8918's user avatar
  • 1,820
0 votes
1 answer
126 views

What is the difference clustered vs non-clustered index when we calculate number of accesses pages?

Employee (Ssn, FirstName, LastName, Gender, Age, Salary, DepartmentID) Assumptions: • There is no index. • There are total 8,000,000 rows. • 250,000 rows fall within the 2,500 to 3,000 salary range. • ...
farukks's user avatar
  • 11
0 votes
0 answers
54 views

SQL Server not using non clustered index

I have table where the PK is a Guid (clustered index) and Name (string, non clustered index) in SQL Server. Every time I run the query with the WHERE and ORDER BY, it only uses the clustered index and ...
thanzeel's user avatar
  • 484
-2 votes
1 answer
77 views

Sqlserver how to create composite unique key with one of column is nullable

i am not expert with indexing. I would like to create a composite key unique constraint. How to create if one of the column is nullable? CREATE UNIQUE CLUSTERED INDEX [IX_User_Email_PeronsId] ON [dbo]....
Mukil Deepthi's user avatar
1 vote
0 answers
99 views

BETWEEN SQL - why is there a gap lock?

CREATE TABLE justpk ( A INT, B INT, PRIMARY KEY (A) ); INSERT INTO justpk (A, B) VALUES (1, 1), (4, 1), (5, 1); +---+------+ | a | b | +---+------+ | 1 | 1 | | 4 | 1 | | 5 | 1 ...
user avatar
1 vote
1 answer
319 views

when exactly does a lock pseudo-record supremum occur?

I need a example, please What do you mean by applying the lock to a pseudo-record? https://dev.mysql.com/doc/refman/8.0/en/innodb-locking.html#innodb-next-key-locks For the last interval, the next-...
user avatar
0 votes
1 answer
218 views

gap locks don't appear in data_locks table - What's happening?

Window 1: mysql> begin; Query OK, 0 rows affected (0.00 sec) mysql> select * from table1 where id > 99 FOR UPDATE; +-----+--------+--------+-------+------+ | id | field1 | field2 | field | ...
user avatar
1 vote
1 answer
548 views

InnoDB Locking - Does record lock use indexes?

https://dev.mysql.com/doc/refman/8.0/en/innodb-locking.html#innodb-intention-locks Record Locks A record lock is a lock on an index record. For example, SELECT c1 FROM t WHERE c1 = 10 FOR UPDATE; ...
user avatar
0 votes
1 answer
228 views

Clustered index key should be part of the non-clustered index key, but how can I see it?

In SQL Server, when a table has clustered index defined on it, the clustered index key will be implicitly added as a "hidden" key to any non-clustered indexes. But how come this "hidden&...
SQL_Guy's user avatar
  • 343
-2 votes
1 answer
55 views

Can table have both primary & clustered index together

Say we have a Student table in a MYSQL database and its schema is below. This table has around Million Records. ID (PK) Name Aadhaar_ID Address Admission_year Can the above table have the following ...
Aditya Goel's user avatar
-1 votes
1 answer
39 views

Why is this query using the index differently when i change the range of search?

I have a question about indexing and a strange (I suppose) behaviour I found when trying out some queries I'm using in a project. I have the following schema: a) an `activities` table +---------+------...
Emiliano Maccaferri's user avatar
1 vote
1 answer
311 views

MySQL Clustered vs Non Clustered Index Performance

I'm running a couple tests on MySQL Clustered vs Non Clustered indexes where I have a table 100gb_table which contains ~60 million rows: 100gb_table schema: CREATE TABLE 100gb_table ( id int ...
vrare's user avatar
  • 15
1 vote
0 answers
28 views

SQL Indexing on uniqueidenfier column is not working

I am trying to put the index to a uniqueidentifier column. Here is the table schema and data: CREATE TABLE [dbo].[TestTable] ( [Id] [uniqueidentifier] ROWGUIDCOL NOT NULL, [ParentId] [...
Xylan Daniel's user avatar
0 votes
1 answer
112 views

If primary key is clustered index in a table then the other columns are eg any unique column is a table is non clustered?

CREATE TABLE people( personID int, FirstName VARCHAR(255), LastNanme VARCHAR(255), Address VARCHAR(255), City VARCHAR(255) PRIMARY KEY (PERSONID) );
Saket khatavkar's user avatar
0 votes
0 answers
71 views

Plot number of tickets opened and closed by month in R

I have a list of tickets and I would to create a graph to show how many opened and closed by month. Every ticket item has 2 data points: opened_at date and closed_at date. I want to create a clustered ...
Marcelo Bastos's user avatar
0 votes
1 answer
225 views

Unique clustered index vs primary key

I have a table with composite primary key of 7 fields, but table is allowing duplicate entries with primary key. Later I noticed it also has Unique clustered index with 10 fields including 7 of ...
Ashish Dubey's user avatar
0 votes
2 answers
417 views

When we create a clustered index does it takes extra space?

I am asking this question with repect to mysql database.I read that clustered index orders the table based on primary key or columns that we provide for making clustered index, where as in non ...
PING's user avatar
  • 1
1 vote
2 answers
332 views

What is stored in the leaf node of clustered index

I understand that in the leaf node of clustered index the table record is stored together with say primary key. But I found some articles stated that primary key is stored with block address of real ...
Drake's user avatar
  • 165
1 vote
1 answer
73 views

How does MYSQL finds the key inside particular index page?

As I understand, MySQL stores clustered index in its custom tree-like data structure (similar to the B+-tree). The node of this tree is called "page" and may contain a significant number of ...
mind_religion's user avatar
0 votes
2 answers
371 views

Clustered Index and Sorting

If you run the following query, for example, the rows could come back in any order: select * from [table_a]; A clustered index sorts the table based on whatever column(s) you choose. That being said, ...
Chicken Sandwich No Pickles's user avatar
0 votes
0 answers
32 views

How does CCI Indexing works?

While creating a CCI Index in SQL Server, we don't have to specify the column name So on which column does the CCI Creates Index? Does CCI Index also sorts the table based on a column like clustered ...
shubham kumar's user avatar
0 votes
1 answer
524 views

Unique constraint and index

I have a table in SQL Server containing some user related info where the primary key is id (auto increment by 1) and has a column named userId. Each user can only has one record in the table, so I ...
once's user avatar
  • 584
0 votes
1 answer
213 views

Impact of adding clustered indexes to SQL Server that is currently in use

I want to add a clustered index to a SQL Server table that I am currently using and have built numerous queries and code around it. I want to be certain that adding these indexes does not affect how I ...
LugalG's user avatar
  • 15
0 votes
1 answer
128 views

Clustered index in SQL Server : any advantage for the columns to be first in schema?

I have a table in SQL Server with a three-column clustered index. I have a table with columns (CustomerID, A, ProductID, C, OtherID) and I have a clustered key on (OtherID, CustomerID, ProductID). Is ...
Thomas Andrews's user avatar
0 votes
0 answers
46 views

Workable clustered indexing work-around for Msg 2601 while retaining narrow scope

I've added a clustered index to some large but necessary temp tables, which has vastly improved the performance of some sluggish slow-running stored procedures. Some of the temp tables have a unique ...
Ganymede's user avatar
0 votes
0 answers
42 views

Index Strategy - Table Design Hourly Data

I am working on a financial project and I am trying to design a table with best index strategy which stores hourly data and I need faster data retrieval. Since its confidential I will explain with an ...
ASmith's user avatar
  • 3
3 votes
1 answer
2k views

Create nonclustered index with Entity Framework Core 5.0.4 with a GUID primary key

I have this entity class: public class StatusCode { public const String ClassName = nameof(StatusCode); [Key] public Guid UniqueID { get; set; } // Primary Key ...
Greg Harris's user avatar
0 votes
0 answers
93 views

Should we fix our schema to avoid using uniqueidentifiers as our Primary Keys if we have SSD disks?

Having inherited a system and addressing performance issues, noticed that for many tables (some with 1-2 million rows) the Primary Key is a GUID and new GUIDs are not set to be Sequential. Being aware ...
cloudsafe's user avatar
  • 2,464
1 vote
1 answer
706 views

Using SYSTEM$CLUSTERING_INFORMATION to identify potential clustering keys

Queries run on my event based database currently scan all rows even if a certain event is filtered - leading to long scan times. Event_type is something that I would use often in filters which is why ...
bingbongtelecom's user avatar
1 vote
0 answers
89 views

Hibernate Search: Index is not updated (works on local cluster but not on dockerized containers on AW$)

Currently using Hibernate Search 5.10, I prepared it to use an infinispan as a directory provider, and in a local 4-cluster JBOSS, it works okay. However, when the containers are on AWS and there's ...
sommer007's user avatar
0 votes
1 answer
22 views

Order of output values when select one field from table. SQL server

In what order will the field values be displayed for "select field from table". Table is a clustered index Anything or as in the table? it looks like in the table. But I would like to know ...
Vyacheslav Ratushnyy's user avatar
2 votes
1 answer
255 views

Heap vs Clustered index full table scan

I've been googling back and forth for this, and could not get a grasp of how are the table data blocks structured on the disk. Many resources state that doing a full table scan reads the blocks ...
Yoni Dor's user avatar
  • 323
0 votes
2 answers
214 views

SQL Server Clustered Index: Unique vs. Increasing

Hello StackOverflow Community. I am currently redesigning a SQL Server DB Table that has to store time based values. The old table was getting around 50,000,000 entries per day which became simply too ...
SoulKa's user avatar
  • 187
0 votes
1 answer
29 views

Can I cluster these records without having to run these loops for every record?

So I want to cluster the records in this table to find which records are 'similar' (i.e. have enough in common). An example of the table is as follows: author beginpage endpage volume ...
user5423254's user avatar
0 votes
0 answers
310 views

Cluster index new cardinality operator disastrous estimation

Recently we changed the Sql Server compatibility level from 110 (sql server 2012) to 150 (2019) after we migrated to Azure Managed instance a while back. We're observing one query getting very very ...
Narcis's user avatar
  • 5,882
0 votes
0 answers
189 views

Recalculation the cluster centroids

The first step of k-medoids is that k-centroids/medoids are randomly picked from your dataset (X), how those centroids are recalculated when there are some clusters changing by the updating x1? ...
Ahmed Ali Alsafar's user avatar
0 votes
1 answer
75 views

Inner join constraint using clustered indexing (need the nulls)

I've create a clustered indexed view and it reduces the query time by 4x. The main problem is that I cannot use full outer joins while doing so, ending up losing up to 20% of records of my dataset (...
mburns's user avatar
  • 74
0 votes
1 answer
759 views

MySQL-Why does this query use full index scan?

I'm currently studying DB index. In the MySQL classicmodels db, I don't know why does this query use full index scan. select salesRepEmployeeNumber, count(*) from customers where ...
Chaeun Gong's user avatar
1 vote
1 answer
706 views

Propagation of BigQuery parition/cluster keys to a CTE table - Performance

I setup a persistent table in our BigQuery database (using Looker, if that's relevant). The table has both a partition_key and a few cluster_keys. I partition on time, then cluster on my primary key ...
Sean's user avatar
  • 433
0 votes
2 answers
132 views

Does clustered index have a separate index file? [closed]

Do clustered indexes have a separate index file or is it the table itself? I read from my textbook that clustered indexes change the physical ordering of the actual file. So does it need a separate ...
sumanth's user avatar
  • 135
0 votes
1 answer
206 views

Creating clustered and non-clustered indexes

I was going through the topic of CLUSTERED INDEX & NON-CLUSTERED INDEX, and I gained some pretty good knowledge about how they work and their effect on performance. The very next thought I had was,...
saint_sharan's user avatar
0 votes
1 answer
473 views

Postgresql "CLUSTER tablename USING indexname;" takes more disk space than table size plus all indexes combined

I have a quite large table in the database. Size of table and its indexes are shown in tables below: table_size ---------------- 22 GB schemaname | scan_count | tablename | indexname | ...
ganjim's user avatar
  • 1,336
0 votes
0 answers
57 views

Error in x[ind, ] - centerI : non-conformable arrays

I have a time series data set. I would like to cluster it using different clustering techniques. Then, I would like to evaluate each method. I tried an R code from clusterSim package. However, I got ...
user avatar
1 vote
0 answers
58 views

replacing object cluster to the new cluster generating the highest SI score

I'm fairly new to python so I hope somebody can help me. we have a list X LABELS [0.85142858] 1 [0.85566274] 0 [0.85364912] 0 [0.81536489] 2 i applied k-means to ...
Man.utd's user avatar
  • 59
0 votes
1 answer
1k views

Converting a Heap table to Clustered table

Problem Overview: We have created a table without a clustered index on Id column and inserted millions of data into that table. When I check the indexes, it shows NULL for the index name. With some ...
Aruna's user avatar
  • 1,992
0 votes
0 answers
340 views

How to deploy a sharded cluster in kubernetes with 2 nodes and 3 replicas and 4 mongos?

I need to create a sharded cluster on k8 using archives yaml. I have just one idea but I have problems with the shards then I want to found another option. Taking in account that to create the sharded ...
Danny Daniel Quintana's user avatar
0 votes
0 answers
235 views

How to correctly use non-clustered index to speed up querying in stored procedure

I'm preparing a stored procedure to join tables and filter out useful rows. To help the querying, I create an non-clustered index on two columns of table A and then drop it in this sp. It works very ...
Harry's user avatar
  • 361

1
2 3 4 5
11