Skip to main content
11 votes

Does Ordering of Columns in INCLUDE Statement of Index Matter?

For index key columns the column ordering is significant. For included columns on the whole it doesn't matter. The order that the non key columns are stored on the index leaf pages won't affect the ...
Martin Smith's user avatar
  • 85.2k
7 votes
Accepted

Enforce non-unique combination of columns, where combination is required

Using a relational database model would have avoided this issue. The pain of converting the data and adapting the application is the price to pay for the incorrect initial design. That said, you can ...
Paul White's user avatar
  • 86.4k
6 votes

Enforce non-unique combination of columns, where combination is required

As someone else suggested, the best thing is to fix the model. It is often possible to use view + instead of triggers for backward compatibility. If not possible and your purpose is to prevent adding ...
Lennart - Slava Ukraini's user avatar
4 votes

Enforce non-unique combination of columns, where combination is required

Create an Images table. ImageId is the Primary Key. Create an additional Unique index on ImageUrl column. ImageId ImageUrl a a.com b b.com The Data table can then have Id, and ImageId as a ...
LeppyR64's user avatar
  • 149
3 votes

Why MariaDB 11 isn't using DateTime index?

This is to be expected. DATETIME is a red herring. But the different column names is important. Let me rewrite the query with fewer keystrokes... The SELECT has two unrelated ranges; MySQL cannot do ...
Rick James's user avatar
  • 78.6k
2 votes

Postgres query planner suddenly changing his mind

I finally understood and I feel stupid. I am going to describe what happend in case someone else runs into the same problem. I am using DBeaver and the connection I am using for this DB has autocommit ...
Istopopoki's user avatar
2 votes

When is re-indexing triggered after multiple updates

The index will be modified right when you insert the row, and there is nothing you can do about that. GIN indexes have a “pending list” that stores new entries without actually adding them to the ...
Laurenz Albe's user avatar
  • 53.5k
1 vote

How to Make Queries on a DATETIME Column Efficient If My Primary Query Pattern is an Hour?

SQL Server and Oracle are different products. SET IDENTITY_INSERT table_name OFF is SQL Server syntax which has no equivalent on Oracle , the most similar might be generated by default as identity ...
Ergest Basha's user avatar
  • 3,945
1 vote

Postgres query planner suddenly changing his mind

Are you sure that you ran the first ANALYZE after you created the index and before you ran the query? If you ran ANALYZE before you created the index, that would explain why the planner chooses a ...
Laurenz Albe's user avatar
  • 53.5k

Only top scored, non community-wiki answers of a minimum length are eligible