Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7419871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:08:41+00:00 2026-05-29T08:08:41+00:00

I have a table with about 100.000 rows that used to look more or

  • 0

I have a table with about 100.000 rows that used to look more or less like this:

id      varchar(20),
omg     varchar(10),
ponies  varchar(3000)

When adding support for international characters, we had to redefine the ponies column to an nclob, as 3000 (multibyte) characters is too big for an nvarchar

id      varchar(20),
omg     varchar(10),
ponies  nclob 

We read from the table using a prepared statement in java:

select omg, ponies from tbl where id = ?

After the ‘ponies’ column was changed to an NCLOB and some other tables where changed to use nchar columns, Oracle 11g decided to do a full table scan instead of using the index for the id column, which causes our application to grind to a halt.

When adding a hint to the query, the index is used and everything is “fine”, or rather just a little bit more slow than it was when the column was a varchar.

We have defined the following connection properties:

 oracle.jdbc.convertNcharLiterals="true"
 defaultNChar=true

Btw, The database statistics are updated.

I have not had time to look at all queries, so I don’t know if other indexes are ignored, but do I have to worry that the defaultNChar setting somehow is confusing the optimizer since the id is not a nchar? It would be rather awkward to either sprinkle hints on virtually all queries or redefine all keys.

Alternatively, is the full table scan regarded as insignificant as a “large” nclob is going to be loaded – that assumption seems to be off by 3 orders of magnitude, and I would like to believe that Oracle is smarter than that.

Or is it just bad luck? Or, something else? Is it possible to fix without hints?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T08:08:41+00:00Added an answer on May 29, 2026 at 8:08 am

    The problem turns out to be the jdbc-flag defaultNChar=true.

    Oracles optimizer will not use indexes created on char/varchar2 columns if the parameter is sent as a nchar/nvarchar. This is nearly making sense, as I suppose you could get phantom results.

    We are mostly using stored procedures, with the parameters defined as char/varchar2 – forcing a conversion before the query is executed – so we didn’t notice this effect except in a few places where dynamic sql is used.

    The solution is to convert the database to AL32UTF8 and get rid of the nchar columns.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a MySQL table with about 5,000,000 rows that are being constantly updated
Guys I'm stumped on this one, I have a large table with 100,000 rows
I have a big table (200'000'000 rows); declared like this thread( forum_id tinyint, thread_id
I have a couple of very large tables (over 400,000 rows) that look like
I have a table with about 5,000 rows which I build dynamically with jQyuery.
I have a table for about 100,000 users in it. First Case: explain select
I have a table with around 100,000 rows at the moment. I want to
I've got a sqlite table actions that looks something like this: uuid varchar (36)
i have this table of comments (little over 1 milion rows) that gets around
i have a table with about 200,000 records. i want to add a field

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.