Skip to content

Tags: added index on ContentTagRecord table.#7591

Merged
sebastienros merged 1 commit into
OrchardCMS:1.10.xfrom
LaserSrl:issue/7590_index_on_contenttagrecord_table
Mar 9, 2017
Merged

Tags: added index on ContentTagRecord table.#7591
sebastienros merged 1 commit into
OrchardCMS:1.10.xfrom
LaserSrl:issue/7590_index_on_contenttagrecord_table

Conversation

@GiuseppeMusso-Laser

Copy link
Copy Markdown
Contributor

Added index on field TagsPartRecord_Id in table ContentTagRecord for performance enhancement.
See issue #7590.

@sebastienros

Copy link
Copy Markdown
Member

Is the actual query on this field only or the two fields of this table. Can you point to the line of code that does the query?
If it's using the two of them (as I would expect) then we need to include both fields in the index. We might also need two indexes btw.

@GiuseppeMusso-Laser

Copy link
Copy Markdown
Contributor Author

I enabled SQL logging in log4net.config file:

<!-- Enable SQL Query Log. -->
<logger name="NHibernate.SQL">
  <priority value="DEBUG" />
</logger>

Then I edited a ContentItem containing tags and I got the following SQL query in my log:

SELECT tags0_.TagsPartRecord_id as TagsPart3_2_, tags0_.Id as Id2_, tags0_.Id as Id561_1_,
tags0_.TagRecord_id as TagRecord2_561_1_, tags0_.TagsPartRecord_id as TagsPart3_561_1_,
tagrecord1_.Id as Id562_0_, tagrecord1_.TagName as TagName562_0_
FROM Orchard_Tags_ContentTagRecord tags0_
left outer join Orchard_Tags_TagRecord tagrecord1_ on tags0_.TagRecord_id=tagrecord1_.Id
WHERE tags0_.TagsPartRecord_id=@p0;
@p0 = 1837 [Type: Int32 (0)]

Here the only where condition is on field TagsPartRecord_id.

@sebastienros
sebastienros merged commit 134bac4 into OrchardCMS:1.10.x Mar 9, 2017
@GiuseppeMusso-Laser
GiuseppeMusso-Laser deleted the issue/7590_index_on_contenttagrecord_table branch November 21, 2017 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants